Codeforces Round #430 (Div. 2) B. Gleb And Pizza
2017-08-30 14:57
435 查看
题目大意
有多少圆在外面圆内里面圆外。题解
求一下圆心到原点距离,然后加r减r判断即可。#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; int read() { char ch=getchar();int f=0; while(ch<'0'||ch>'9') ch=getchar(); while(ch>='0'&&ch<='9') {f=f*10+(ch^48);ch=getchar();} return f; } int d,R; int main() { int n,ans=0; d=read(),R=d-read(); n=read(); for(int i=1;i<=n;i++) { double x,y,r; scanf("%lf%lf%lf",&x,&y,&r); double len=sqrt(x*x+y*y); if(len-r>=R&&len+r<=d) ans++; } cout<<ans; }
相关文章推荐
- Codeforces Round #430 (Div. 2) B. Gleb And Pizza
- Codeforces Round #430 (Div. 2) B. Gleb And Pizza(数论)
- Codeforces Round #430 (Div. 2) B. Gleb And Pizza
- 【Codeforces Round #430 (Div. 2) B】Gleb And Pizza
- Codeforces Round #430 B. Gleb And Pizza
- 【 Codeforces Round #430 (Div. 2) A 】 Kirill And The Game
- Codeforces Round #430 (Div. 2) C. Ilya And The Tree 树dp 统计
- Codeforces Round #430 (Div. 2) C. Ilya And The Tree dfs+set
- Codeforces Round #430 (Div. 2) D. Vitya and Strange Lesson
- Codeforces Round #430 (Div. 2) C. Ilya And The Tree dfs+set
- Codeforces Round #430 (Div. 2) C. Ilya And The Tree
- Codeforces Round #430 (Div. 2) C. Ilya And The Tree dfs+set
- Codeforces Round #430 (Div. 2) D. Vitya and Strange Lesson
- Codeforces Round #430 (Div. 2) D. Vitya and Strange Lesson
- Codeforces Round #430 (Div. 2) C Ilya And The Tree SET暴力
- Codeforces Round #430 (Div. 2) C. Ilya And The Tree dfs+set
- Codeforces Round #430 (Div. 2) D. Vitya and Strange Lesson
- Codeforces Round #430 (Div. 2) E. Nikita and game
- Codeforces Round #430 (Div. 2) C. Ilya And The Tree(补题)
- Codeforces Round #430 (Div. 2) Vitya and Strange Lesson