codeforces div2 round#230 C
来源:互联网 发布:cosplay淘宝良心卖家 编辑:程序博客网 时间:2024/04/29 21:02
不得不说这题目把我坑得不行。
一开始读题的时候就没理解清楚题意。后来大概理解了内容,却把握错了题目的方向。我始终认为这货是有特定的公式的,所以就忽略了题目给的数据范围。
考虑到圆的对称性,我们只需要扫描1/8圆就可以了。。。注意一下精度啥的,直接暴力这题就可以过。
打的比赛还是太少,对cf的出题方向啥的还不是很熟悉。
#include "cstdio"#include "cmath"using namespace std;#define LL long longbool check(LL x,LL y,LL n){ if((x+1)*(x+1)+y*y>n||x*x+(y+1)*(y+1)>n) return 1; return 0;}int main(){ LL n,m; scanf("%lld",&n); LL flag=0; if(n==0){ printf("1\n"); return 0; } LL x,y; m=n*n; LL ans=0; for(x=1;x<n;x++){ y=(LL)sqrt(m-x*x); if(x>=y) break; if(check(x,y,m)) ans++; } if(x==y&&check(x,y,m)) flag=4; printf("%lld\n",ans*8+4+flag); return 0;}
0 0
- codeforces div2 round#230 C
- Codeforces round 181 div2 C
- codeforces div2 round#231 C
- Codeforces - Round.313.Div2.C
- codeforces Round #352 div2 C
- Codeforces Round #409 div2 C
- Codeforces round#429 div2 C
- Codeforces Round #429 (Div2) C
- CodeForces Round 230 Div2 D
- codeforces div2 round#230 A
- codeforces div2 round#230 B
- codeforces div2 round#230 D
- codeforces div2 round#230 E
- codeforces Round #237(div2) C解题报告
- codeforces Round #241(div2) C解题报告
- codeforces round #257 div2 C、D
- Codeforces Round #262(div2) C. Present
- codeforces Round #269(div2) C解题报告
- codeforces div2 round#230 B
- java学习日记
- 加断点能通过,不加断点出错
- 矩阵快速幂(模板)
- 年度总结(13-14)
- codeforces div2 round#230 C
- STM32F4XX工程步骤
- 浅谈Redis数据库的键值设计
- HDU 1702 ACboy needs your help again!(栈与队列的基本使用)
- 7 纹理映射
- 2014Dedecms标签新增中...
- dfs
- 文件操作(OJ数据生成)
- 贪心 删数问题