Central Europe Regional Contest 2012 Problem H: Darts
http://acm.hunnu.edu.cn/online/problem_pdf/CERC2012/H.pdf
HUNNU11377
题意:飞镖环有十个环,没个环从外到里对应一个得分1~10,每个环有一定的半径,给出n次丢飞镖的坐标,求出得分
思路:直接算出左边离原点的半径判断在哪个环里即可,然后求出半径,一开始将判断全部写成了函数,在循环里调用超时了,将所有判断移到循环内就AC了,坑!
#include <stdio.h>
#include <math.h>
#include <string.h> int main()
{
int t,n,x,y,r,sum;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
sum = 0;
while(n--)
{
scanf("%d%d",&x,&y);
r = x*x+y*y;
if(r>=0 && r<=400)
sum+= 10;
else if(r>400 && r<=1600)
sum+= 9;
else if(r>1600 && r<=3600)
sum+= 8;
else if(r>3600 && r<=6400)
sum+= 7;
else if(r>6400 && r<=10000)
sum+= 6;
else if(r>10000 && r<=14400)
sum+= 5;
else if(r>14400 && r<=19600)
sum+= 4;
else if(r>19600 && r<=25600)
sum+= 3;
else if(r>25600 && r<=32400)
sum+= 2;
else if(r>32400 && r<=40000)
sum+= 1;
}
printf("%d\n",sum);
}
return 0;
}
Central Europe Regional Contest 2012 Problem H: Darts的更多相关文章
- Central Europe Regional Contest 2012 Problem c: Chemist’s vows
字符串处理的题目: 学习了一下string类的一些用法: 这个代码花的时间很长,其实可以更加优化: 代码: #include<iostream> #include<string> ...
- Central Europe Regional Contest 2012 Problem I: The Dragon and the Knights
一个简单的题: 感觉像计算几何,其实并用不到什么计算几何的知识: 方法: 首先对每条边判断一下,看他们能够把平面分成多少份: 然后用边来对点划分集合,首先初始化为一个集合: 最后如果点的集合等于平面的 ...
- Central Europe Regional Contest 2012 Problem J: Conservation
题目不难,感觉像是一个拓扑排序,要用双端队列来维护: 要注意细节,不然WA到死 = =! #include<cstdio> #include<cstring> #includ ...
- ACM ICPC Central Europe Regional Contest 2013 Jagiellonian University Kraków
ACM ICPC Central Europe Regional Contest 2013 Jagiellonian University Kraków Problem A: Rubik’s Rect ...
- 2020.5.16-ICPC Central Europe Regional Contest 2019
A. ABB #include <bits/stdc++.h> using namespace std; #define PB push_back #define ZERO (1e-10) ...
- 2017-2018 ACM-ICPC, Central Europe Regional Contest (CERC 17)
A. Assignment Algorithm 按题意模拟即可. #include<stdio.h> #include<iostream> #include<string ...
- 【枚举】Southwestern Europe Regional Contest H - Sheldon Numbers
https://vjudge.net/contest/174235#problem/H [题意] 求[x,y]之间有多少个Sheldon Number Sheldon Number是二进制满足以下条件 ...
- The Ninth Hunan Collegiate Programming Contest (2013) Problem H
Problem H High bridge, low bridge Q: There are one high bridge and one low bridge across the river. ...
- 【优先级队列】Southwestern Europe Regional Contest Canvas Painting
https://vjudge.net/contest/174235#problem/D [题意] 给定n个已知size的帆布,要给这n块帆布涂上不同的颜色,规则是这样的: 每次选择一种颜色C 对于颜色 ...
随机推荐
- 数据库中操作XML(openXML)
最近公司项目需要在数据库中操作XML,因此系统的学习了一下 一.openxml的格式 OPENXML( idoc int [ in] , XPathnvarchar [ in ] , [ flags ...
- 基于visual Studio2013解决C语言竞赛题之0519最大值
题目
- 安装虚拟机时出现The Microsoft Runtime DLL
参考文档: http://zhidao.baidu.com/link?url=1E4vr6ToPGm_kAZw4voOqzrPtzGaSIqy3kvcGXehs3KJAkirNKOHJbrsxec3f ...
- 西安力邦智能医疗&可穿戴设备沙龙--第1期---苹果HealthKit、谷歌GoogleFit来袭,智能医疗要爆发吗?
背 景: "可穿戴设备"成为2014的行业热点,从Google Glass到苹果iWatch, 越来越多的企业推出了包含眼镜.腕带.鞋等各种可穿戴设备,"可穿戴&q ...
- SQL__用命令删除定期的备份数据库文件
用计划任务可以定期执行下列语句: FORFILES /P e:\test /M *.bak /C "cmd /C del /Q @path" /d -4 其中可更换目录与文件类型. ...
- c语言利用指针计算字符串的长度
可以用strlen函数,这里我们自己写一个. 注意:不能用scanf,scanf一遇到空格就认为输入结束.应该用gets(),遇到换行符或EOF结束.说明可以接受空格. #include<cst ...
- Oracle百问百答(二)
Oracle百问百答(二) 11. nvl函数有什么用? NVL( string1, replace_with) 功能:如果string1为NULL,则NVL函数返回replace_with的值,否则 ...
- Tri_integral Summer Training 9 总结
比赛链接 A B C D H I J K 多灾多难的 Summer Training 9,前一天挂了一场比赛,结果题一半不能做,于是打了一个小时就放弃了.之后的两场Summer Training 9一 ...
- Cubieboard4卡片式电脑
Cubieboard4 also named CC-A80, is a open source mini PC or single board computer which has ultra-pow ...
- 基于visual Studio2013解决算法导论之006最大堆排序
题目 最大堆排序 解决代码及点评 #include <stdio.h> #include <stdlib.h> #include <malloc.h> #i ...