当前位置:网站首页>(2022牛客多校五)H-Cutting Papers(签到)
(2022牛客多校五)H-Cutting Papers(签到)
2022-08-08 23:06:00 【AC__dream】
样例输入:
2022
样例输出:
3649785.912339927
题意:求|x|+|y|+|x+y|<=n所在的区域和x*x+y*y=(n/2)*(n/2)所在区域的面积并。
这道题就是一个签到题,图如下:
直接用圆的面积加上2*(小正方形面积-1/4圆面积)即可。
下面是代码:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<vector>
#include<cmath>
using namespace std;
#define pi acos(-1)
const int N=1e4+10;
int main()
{
long double n;
while(scanf("%Lf",&n)!=EOF)
{
long double ans=n/4*n*pi;
ans+=(n*n/4-n/4*n*pi/4)*2;
printf("%.10Lf\n",ans);
}
return 0;
}
边栏推荐
猜你喜欢
随机推荐
如何搭建一套自己公司的知识共享平台
ArcPy elements batch to dwg
MySQL给表里的某个字段建立索引
stm32使用spi1在slave 模式下 dma 读取数据
JS中的作用域与作用域链
You know you every day in the use of NAT?
(2022牛客多校五)B-Watches(二分)
Qt入门(四)——连续播放图片(两种定时器的运用)
JSDay2-两个数组的交集
wps a列不见了怎么办?wps a列不见了的解决方法
MPLS Virtual Private Network Everywhere in Life
Excuse me: is it safe to pay treasure to buy fund on
IMConversation 或 IMUser 类型数据
WeChat applet wx:for loop output example
(Codeforce 757)E. Bash Plays with Functions(积性函数)
Dynamic Host Configuration Protocol DHCP (DHCPv4)
设计分享|基于单片机的P0口驱动LED闪烁
Python object-oriented
用工具实现 Mock API 的整个流程
ArcPy spot number - automatically fill according to field length