HDU5120Intersection(两圆环相交的面积)

OpenClaw 股票自动化交易实践指南:从原理到实战的完整技术路径 量化交易策略的开发是一个系统工程,需要综合运用金融知识、编程技能和数据分析能力。OpenClaw通过引入提示词工程技术,大大降低了策略开发的技术门槛,使得更多投资者能够参与到量化交易中来。但技术只是工具,真正决定策略成败的是对市场的深刻理解和严格的风险管理。本章系统介绍了OpenClaw环境下的策略开发方法,从提示词驱动到传统代码实现,从参数优化到回测验证,涵盖了策略开发的完整流程。提示词驱动方式适合快速验证交易想法,传统代码方式适合实现复杂的定制逻辑,两种方式可以协同使用,发挥各自的优势。 阅读详情

HDU5120Intersection(两圆环相交的面积)这里写链接内容

我的:
这个是两个圆环相交的面积,题意是:给出两个同心的圆环,他们的小圆大圆的半径都一样,只是坐标不相等,之后要求求两个圆环的相交的面积,这个要套用利用到两个圆的相交面积的一个模板,感觉很流畅。
之后再利用这个关系式:
Area圆环==intersection_area圆环A的大圆&圆环B的大圆-intersection_area圆环A的大圆&圆环B的小圆-intersection_area圆环A的小圆&圆环B的大圆+intersection_area圆环A的小圆&圆环B的小圆圆。

我的:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <set>
#include <cmath>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>

#define PI acos(-1.0)

using namespace std;
const int maxn=100000+10;


struct Circle
{
    double x,y;
    double r;
}ca,cb,cc,cd;

double intersection_area(Circle c1,Circle c2)//求两圆相交面积的函数
{
    double d;
    double angle1,angle2,s1,s2,s3,s,temp;
    d=sqrt((c1.x-c2.x)*(c1.x-c2.x)+(c1.y-c2.y)*(c1.y-c2.y));
//    cout<<d<<endl;
    if(d>=c1.r+c2.r)
        return 0;
    if(c1.r-c2.r>=d)
        return PI*c2.r*c2.r;
    if(c2.r-c1.r>=d)
        return PI*c1.r*c1.r;
    angle1=acos((c1.r*c1.r+d*d-c2.r*c2.r)/(2*c1.r*d));
    angle2=acos((c2.r*c2.r+d*d-c1.r*c1.r)/(2*c2.r*d));
    s1=c1.r*c1.r*angle1;
    s2=c2.r*c2.r*angle2;
    s3=c1.r*d*sin(angle1);
//    cout<<c1.r<<" "<<d<<' '<<sin(angle1)<<endl;
//    cout<<angle1<<" "<<angle2<<" "<<s1<<" "<<s2<<" "<<s3<<endl;
    s=s1+s2-s3;
    return s;
}


int main()
{
   int time;
   scanf("%d",&time);
   int k=0;
   while(time--)
   {
       k++;
       scanf("%lf%lf",&ca.r,&cb.r);
       scanf("%lf%lf",&ca.x,&ca.y);
       scanf("%lf%lf",&cc.x,&cc.y);
       cc.r=ca.r;
       cd.r=cb.r;
       cb.x=ca.x;
       cb.y=ca.y;
       cd.x=cc.x;
       cd.y=cc.y;
       double area=intersection_area(cb,cd)-intersection_area(ca,cd)-intersection_area(cb,cc)+intersection_area(ca,cc);
      printf("Case #%d: %.6llf\n",k,area);
   }
   return 0;
}
LVGL 组件对齐方式说明 本文说明 LVGL(以 v8 为例)中常用的 lv_align_t对齐选项的含义与用法,对应界面设计工具里下拉列表中的以及等命名。 阅读详情

相关推荐

第十篇|网络子系统 ②——无损以太网、PFC/ECN、DCQCN 与拥塞可视化

网络部分了解了解

qq_37535542的博客 1883

HDU 5120 计算两圆环相交面积

HDU 5120 Intersection Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know. A ring is a 2-D figure bound...

HappyCode 378

STM32 FATFS文件系统按行读取SD卡数据

STM32 SD数据实现按行读取

qq_32216815的博客 7840

hdu5120 Intersection(求两个圆环相交的面积)

Intersection Time Limit: 4000/4000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 206    Accepted Submission(s): 86 Problem Description Matt is a big

无奈滴微笑 1423

Bob-Smith电路在千兆以太网(1000BASE-T)中的优化设计与性能分析

本文深入探讨了Bob-Smith电路在千兆以太网(1000BASE-T)中的关键作用与优化设计。分析表明,相较于单纯追求75欧姆电阻的精确匹配,优化重点应转向PCB布局对称性、高频元件选型及共模路径完整性,以有效抑制共模噪声、提升信号完整性,并确保系统通过EMC测试。

weixin_29281941的博客 289

【实战技巧】matplotlib中文标签显示问题的3种高效解决方案

本文详细介绍了解决matplotlib中文标签显示问题的3种高效方法,包括修改字体设置、临时指定字体和修改后端配置。针对不同操作系统和环境提供了实用技巧,帮助开发者快速解决中文显示为方框的常见问题,提升数据可视化效果。

weixin_30855099的博客 176

求两圆环相交部分的面积

Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know. A ring is a 2-D figure bounded by two circ

hldfight 3924

从个体到群体:Cartool实战静息态EEG微状态聚类全解析

本文详细解析了使用Cartool软件进行静息态EEG微状态聚类的完整实战流程。从个体水平聚类到群体模板提取,再到指标量化,文章深入探讨了k-means算法的应用、GFP峰值数据的使用技巧以及关键参数设置,为脑电信号处理研究者提供了从数据准备到结果解读的全方位指南。

weixin_29062671的博客 293

Intersection (圆环相交的面积,两圆相交面积模板)

Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know. A ring is a 2-D figure bounded by two circles ...

自渡的博客 1051

【DRAM存储器六十七】DDR5介绍--训练相关之write leveling

详述DDR5 write leveling细节

highman110的博客 314

【Microchip】微芯 MPLAB® X IDE开发环境新建项目(点亮1颗LED灯)(常用右键菜单快捷键)

1.新建项目2. 选择芯片型号和调试器3.选择编译器4.项目命名和选择文件路径5.新建成功,给项目添加main.c7.将新建的mainXC16.c文件添加进项目6000000UL这三个就是。

Naiva的博客 463

机器学习知识总结 —— 11. 关于目标检测中的IoU是什么

文章目录1. 什么是 IoU2. 什么是「边界框(bounding box)」3. 如何计算IoU 1. 什么是 IoU 在深度学习的相关任务中,尤其当涉及到目标识别这一类的任务时,总能在论文或博客中看到或者听到 IoU,那么 IoU 指的是什么,它又是如何计算的呢? IoU 的全称是「Intersection of Union」对应的中文是「交并比」,也就是交集与并集的比。我们来看看示例图: 它表示的是我们的检测区域与目标区域的重合程度,所以自然它的取值范围在 [0,1][0, 1][0,1]。 2.

老程的技术笔记 7297

如何利用通达信进行选股集合操作

每个交易者实际上都有自己的选股策略,这是必然的,也会有自己的主观干预,但是还是需要从客观热点股票进行一个比对的,才能说主观和客观相结合不至于​偏离方向。 这几天我也发了节前最后一天我的选股策略盘中的选择结果, 我也从网上拿到了热点股票池,当拿到之后你会发现如何从几十个股票热点股票选出核心票,这就是个问题了,这里面一定要通过股价涨跌幅来进行过滤,而不是通过指标,因为一切指标都是根据价格变化而改变的了,所以​这一步不要走弯路。 1、把拿到的热点股票名单,导入通达信自定义板块 2、删除

抢财猫股票课堂 2592

Hdu 5120 Intersection【计算圆环相交面积】

Intersection Time Limit: 4000/4000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 1861 Accepted Submission(s): 709 Problem Description Matt is a big fa

希望的专栏 903

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

HDU - 5120 Intersection(求两圆环相交面积)

题目链接:https://vjudge.net/contest/368031#problem/B Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know. A...

zaiyang遇见 448

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

hdu 5120 Intersection (圆环面积相交->圆面积相交)

Problem Description Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know. A ring is a 2-D figure b...

dddddd12345456的博客 211

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

HDU 5120 Intersection (求圆环相交面积)

题意:给定圆环的内径r和外径R,以及2个相同圆环的圆心,求两个圆环的相交面积。 思路: S = A大B大 - A大B小 - A小B大 + A小B小。(A表示A环,大表示大圆,B同) 1 #include <iostream> 2 #include <queue> 3 #include <stack> 4 #inclu...

weixin_30548917的博客 151

I - Intersection HDU - 5120(圆环相交面积)

Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know. A ring is a 2-D figure bounded b...

weixin_34362790的博客 158

HDU-5120-Intersection【几何-相交圆面积】

HDU-5120-Intersection

Linoy 911

HDU 5120 Intersection 圆相交面积

题目链接:HDU5120 Intersection Time Limit: 4000/4000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 2855    Accepted Submission(s): 1061 Problem Descript

teddywang 318

Intersection HDU - 5120(圆相交面积)

Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know. A ring is a 2-D figure bounded by two circles shari...

tomjobs的博客 432

hdu5120Intersection+圆环的面积交

Problem Description Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know.A ring is a 2-D figure bounded b

xtulollipop 556

Intersection(HDU5120 + 圆交面积)

题目链接:   http://acm.hdu.edu.cn/showproblem.php?pid=5120 题目: 题意:   求两个圆环相交的面积。 思路:   两个大圆面积交-2×大圆与小圆面积交+两小圆面积交。 代码实现如下: 1 #include <set> 2 #include <map> 3 #includ...

di6499的博客 195

HDU 5120 Intersection

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5120 题意: 给定相同的两个圆环的位置,求圆环的相交面积。 思路:分解成圆的相交问题即可。设S(r1, r2)表示圆r1和r2的相交面积。第一个圆环的大小半径分别为R1,r1,第二个为R2,r2; 若两圆环无相交部分,则输出0; 若两圆环相交,分三种情况: 1. 仅仅只有外部

Mad_boys的博客 513

HDU 5120 Intersection(圆的面积交)

题目大意:给你两个圆环,让你求出来圆环的面积交,需要用到圆的面积交,然后容斥一下,就可以得到圆环的面积交。画一下图就会很清晰。 Intersection Time Limit: 4000/4000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 526    Acce

I am a slow walker, but I never walk backwards! 1101

Intersection HDU - 5120 (求两圆交集面积)

Matt is a big fan of logo design. Recently he falls in love with logo made up by rings. The following figures are some famous examples you may know. A ring is a 2-D figure bounded by two circles sh

退役的铜牌狗 587
上一篇: HDU1798 Tell me the area(两圆的相交面积)
下一篇: hdu5753Permutation Bo(排列问题)
Lazines_by
博客等级 码龄11年 54粉丝 373原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值