Hard problem(两圆相交)

audio框架学习-Audio_Flinger分析 文章目录一、代码位置二、audio服务启动2.1 main服务2.2 audioflinger添加到系统服务中2.3 audioflinger的对外接口 之前记录过audioTrack的笔记,这次继续参考audioFlinger相关的代码并做笔记; 参考文档:https://www.cnblogs.com/innost/archive/2011/01/15/1936425.html和https://blog.csdn.net/zyuanyun/article/details/60890534?spm=100 阅读详情
Hard problem
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 843    Accepted Submission(s): 527
Problem Description
cjj is fun with math problem. One day he found a Olympic Mathematics problem for primary school students. It is too difficult for cjj. Can you solve it?


Give you the side length of the square L, you need to calculate the shaded area in the picture.


The full circle is the inscribed circle of the square, and the center of two quarter circle is the vertex of square, and its radius is the length of the square.
 
Input

The first line contains a integer T(1<=T<=10000), means the number of the test case. Each case contains one line with integer l(1<=l<=10000).


Output
For each test case, print one line, the shade area in the picture. The answer is round to two digit.

Sample Input
1 1
 

Sample Output
0.29

(area_S表示S的面积)

以正方形左下角为坐标轴原点,分别以正方形下边、左边为X轴,Y轴,以左上角为圆心(0,l)半径为l作圆S1,以右下角(l,0)为圆心半径为l作圆S2,正方形内切圆是以(l/2,l/2)为圆心,l/2为半径的圆S。

思路:求出圆S与圆S1相交部分面积area1和圆S与圆S2的相交面积area2,设S中空白部分面积为X,有area1+area2-X=area_S;求出X,用area_S-X即得阴影部分面积。area1与area2是相等的,所以用求出一个即可。

只要敲出两圆相交面积模板就行了:

#include<stdio.h>
#include<iostream>
#include<cmath>
using namespace std;

#define pi acos(-1.0)

typedef struct node
{
	double x;
	double y;
}point;
//两圆相交求阴影面积
double AREA(point a, double r1, point b, double r2)
{
	double d = sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));
	if (d >= r1+r2)
		return 0;
	if (r1>r2)
	{
		double tmp = r1;
		r1 = r2;
		r2 = tmp;
	}
	if(r2 - r1 >= d)
		return pi*r1*r1;
	double ang1=acos((r1*r1+d*d-r2*r2)/(2*r1*d));
	double ang2=acos((r2*r2+d*d-r1*r1)/(2*r2*d));
	return ang1*r1*r1 + ang2*r2*r2 - r1*d*sin(ang1);
}

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n;
        scanf("%d",&n);
        point a, b;
        a.x=n*1.0/2, a.y=n*1.0/2;
	    b.x=n*1.0, b.y=0.0;
	   double result = AREA(a, n*1.0/2.0, b, n*1.0);
	   printf("%.2lf\n",2.0*pi*(n*1.0/2.0)*(n*1.0/2.0)-2.0*result);
    }
	return 0;
}

【OpenFOAM】-olaFlow-算例10-wavemakerTank 采用 Flap和Piston两种方式的动网格进行造波 阅读详情

相关推荐

Lenovo 拯救者15ISK硬件升级实战:从内存到固态硬盘的全面优化

本文详细介绍了为联想拯救者15ISK笔记本电脑进行硬件升级的完整实战指南。通过评估升级可行性,指导如何挑选兼容的内存条与NVMe固态硬盘,并提供详细的拆机安装步骤与系统安装避坑技巧。升级后,笔记本的开机速度、软件加载及多任务处理能力获得飞跃式提升,让老旧设备重获新生。

weixin_29310631的博客 567

几何问题(求两圆相交的面积)

  编辑 删除 Description     There are two circles in the plane (shown in the below picture), there is a common area between the two circles. The problem is easy that you just tell me the common area....

JKdd123456的博客 8111

IEPE传感器4mA恒流源接口电路

另外传感器的偏置电压大概在10V多点,一般接个电容把直流分量去掉。这里我们要把恒流源的电流设置在4毫安左右,R1取33Ω差不多正好。经过CR的隔直流电路后的波形是这样的。

老白的博客 6148

八皇后问题集合

基础八皇后 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。 你的任务是,对于给定的N,求出有多少种合法的放置方法 输入格式: 共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量; 输出格式: 共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量 输入样例: 在这里给出一组输入。例如: 1 8 5 输出样例: 在这里给出相应的输出。例如: 1 92 10 题解: #incl

Handsomk 504

SIwave仿真手册——信号完整性仿真之S参数的提取(二)

上一篇简单了讲述了软件的各个操作界面,本次博客更新关于的仿真,因为第二章完整的内容比较多,所以分成好几篇博客进行分享。

luohuo9844的博客 1万+

从零构建2.4G无线通信系统:MSPM0G3507与NRF24L01的深度协同设计

本文详细介绍了基于MSPM0G3507微控制器与NRF24L01射频模块构建2.4G无线通信系统的深度协同设计方案。内容涵盖系统架构、SPI通信优化、功耗管理、抗干扰机制及中断/DMA高效利用,为工业物联网应用提供高可靠、低功耗的无线传输解决方案。

rice5的博客 827

c++求阴影部分面积_模型 | 求圆中阴影部分面积问题的10种方法

好文赏析【00】几何“动点问题”中的最值模型【01】初中最值问题的19大类型【02】最值问题的11大类型归纳与策略梳理【03】一题多变/一题多问/一题多解/一 一聚多【04】网格中的数学问题考点全梳理【05】一道二次函数经典题的50种问法【06】反比例函数中K的几何意义及二级结论全梳理【07】初中数学23种模型分年级段全梳理【08】利用辅助圆求解动点最值问题【09】2020年中考数学专题...

weixin_39605347的博客 1218

最强解析!CWRU轴承数据集Python实战:从数据加载到模型部署全流程

本文提供了一份完整的CWRU轴承数据集Python实战指南,涵盖从数据加载、预处理、特征工程到模型构建与训练的全流程。详细解析了如何利用1D-CNN、Transformer等深度学习模型进行轴承故障诊断,并介绍了模型评估、可解释性分析以及通过FastAPI部署模型的实用方法,为工业设备智能运维提供了一套可复用的解决方案。

time3的博客 367

求两圆环相交部分的面积

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 3925

【PT+Arduino+OneNET基础教程1】PacketTracer中MCU芯片编程教程(零基础入门)

PacketTracer软件内MCU芯片编程入门 零基础

ChloeMax_的博客 9470

45、数据挖掘学术文献推荐

本文是一篇关于数据挖掘领域的重要学术文献推荐,涵盖了经典理论与最新研究成果。内容包括关键研究论文、综述文章、教科书和专著的介绍,以及来自顶级会议和期刊的出版物推荐。此外,还探讨了数据挖掘与其他领域的交叉研究,如机器学习、统计学和数据库系统,并列举了多个实际应用案例。最后,分析了数据挖掘的未来发展趋势,如更加智能化的算法、高效的计算平台及隐私保护技术。无论是初学者还是专业人士,这些文献都将提供宝贵的学习资源和前沿动态。

qsc90123456的博客 230

两圆求面积问题

已知两个圆的圆心半径,求两圆所覆盖的面积 注意这里两圆的位置有三大类别: I 相离或外切 II 内切或包含 III 相交 但是相交需要两种算面积的方式 这里需要用到三角函数和反三角函数以及明确反三角函数的定义域等知识点 废话不多说(也没啥好多说的),上代码。代码已在DEV C++编译通过(gcc环境)   #include"iostream" #include"math.h"  ...

qq_38195687的博客 766

【音视频】PJSIP库——示例简介、C++类说明

aectest音频回声消除测试工具,用于演示音频处理模块中的回声消除(AEC)功能,通常用于 VoIP 场景中优化语音质量。auddemo音频播放 / 录制演示,展示如何使用 PJProject 的音频接口进行基本的音频数据采集、播放和处理,例如波形显示或格式转换。stereotest立体声处理测试,可能用于演示多声道音频的处理方式,如混音、声道分离等。tonegen音频信号生成工具,用于生成测试用的音频信号(如正弦波、音调等),常用于音频设备测试或调试。recfile。

郭老二 440

HDU - 5858 Hard problem 【两圆相交的面积】

Hard problemTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 906    Accepted Submission(s): 554Problem Descriptioncjj is fun with math problem. O...

哇-WA 的博客 215

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

HDU 5858 Hard problem【两圆的面积交】

Hard problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 643    Accepted Submission(s): 410 Problem Description cjj is fun with

Puya的博客 446

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

CodeForces - 687A NP-Hard Problem (二分图判断染色法)

NP-Hard Problem Recently, Pari and Arya did some research about NP-Hard problems and they found theminimum vertex coverproblem very interesting. Suppose the graphGis given. SubsetAof its verti...

YOONGI 313

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

HDU-5858-Hard problem(几何)

链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5858 题意:知道正方形边长,求阴影部分面积 题解:直接求出两圆相交部分面积。 CODE: #include using namespace std; #define PI acos(-1) #define eps 1e-5 double Area_of_overlap

不会吃鱼的喵 554

HDU 5858 Hard problem 2016多校10 1002 [相交圆面积]【计算几何】

题目连接 : 就当前HDU的情况 就先不给了 ——————————————————————–. Hard problemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 195 Accepted Submission(s): 1

Tabris的博客 721

CodeForces 687A NP-Hard Problem

A. NP-Hard Problem Recently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting. Suppose the graph G is given. Subset

nudt_oys的博客 480

NP-Hard Problem(cf#360)

C. NP-Hard Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Recently, Pari and Arya did some researc

Limhhhhh的博客 705

NP-Hard Problem codeforces (二分图,dfs)

NP-Hard Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Recently, Pari and Arya did some research about NP-Hard problems a

Hanylch 511

codeforces 360 C - NP-Hard Problem

转载自:http://www.cnblogs.com/shawn-ji/p/5668293.html#3470095 原题: Description Recently, Pari and Arya did some research about NP-Hard problems and they found theminimum vertex coverprobl...

Dara2015的博客 201

C - NP-Hard Problem(二分图判定-染色法)

C - NP-Hard Problem Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 688C uDebug ...

152

codeforces 687A NP-Hard Problem

http://www.elijahqi.win/archives/1154 Recently, Pari and Arya did some research about NP-Hard problems and they found the minimum vertex cover problem very interesting. Suppose the graph G is given...

Elijahqi 275

codeforces C. NP-Hard Problem 二分图的判定

C. NP-Hard Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Recently, Pari and Arya did some researc

liyunlonghere 605

Codeforces 687A NP-Hard Problem

A. NP-Hard Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Recently, Pari and Arya did some researc

nare123的博客 432
上一篇: E(Tarjan)
下一篇: CodeForces - 471D
xiaoxiede_wo
博客等级 码龄10年 65粉丝 233原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值