Chaarshanbegaan at Cafebazaar

题目链接

http://icpc.upc.edu.cn/problem.php?cid=1618&pid=1

题目描述

Chaarshanbegaan is a gathering event at Cafebazaar similar to TGIF events at Google. Some entertainment programs like pantomime, foosball, Xbox/PS4, and several board games are part of the event. You are going to set up a dart game in Chaarshanbegaan. As a techie organizing a game for techies, you would rather use a smart screen and write a program to calculate the scores instead of hanging a traditional dartboard and scoring the shots manually. Your program must get the coordinates of dart shots for a player and calculate his/her total score. The score for each dart shot (at point (x, y)) is calculated based on its distance from the center of the dartboard (point (0, 0)). If the distance is d millimeters, the score is calculated based on the following table:

点此查看题目图片

输入

The first line of the input contains a single integer N as the number of dart shots for a player (1 ⩽ N ⩽ 100). Each of the next N lines contains two space-separated integers as the coordinates (x, y) of a dart shot. The coordinates are in millimeters and their absolute values will not be greater than 300.

输出

Print a single line containing the total score of the player.

样例输入

2
4 7
-31 -5

样例输出

18

题解

签到水题

代码

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define memset(x,y) memset(x,y,sizeof(x))
#define memcpy(x,y) memcpy(x,y,sizeof(y))
#define all(x) x.begin(),x.end()
#define readc(x) scanf("%c",&x)
#define read(x) scanf("%d",&x)
#define read2(x,y) scanf("%d%d",&x,&y)
#define read3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define print(x) printf("%d\n",x)
#define lowbit(x) x&-x
#define lson(x) x<<1
#define rson(x) x<<1|1
#define pb push_back
#define mp make_pair
typedef pair<int,int> P;
typedef long long LL;
typedef long long ll;
const double eps=1e-8;
const double PI = acos(1.0);
const int INF = 0x3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int MOD = 1e9+7;
const ll mod = 998244353;
const int MAXN = 1e6+7;
const int maxm = 1;
const int maxn = 100000+10;
int T;
int n,m;
int p1,p2;
int s1,s2;
int x,y;
int ans = 0;
int scr[15] = {0,100,900,2500,4900,8100,12100,16900,22500,28900,36100,90001}; int main()
{
int n;
int x,y;
read(n);
int sum = 0;
rep(i,0,n)
{
read2(x,y);
int temp = x*x+y*y;
if(temp == 0 ) {sum+= 10 ;continue;}
rep(j,1,12)
{
if(temp<=scr[j] && temp>scr[j-1])
{
sum += 11 - j;
break;
}
}
}
cout<<sum<<endl; }

最新文章

  1. windows编程环境
  2. x64内联汇编注意点
  3. 用eclipse碰到的一些错误,然后自己去网上找的解决办法
  4. 2015年第2本(英文第1本):《The Practice of Programming》
  5. 通过EasyUI Tree说明SQL GUID和自增列ID的使用场景
  6. SqlServer_Sql防止注入
  7. jQuery Dialog弹出层对话框插件
  8. 微软SpeechRecognitionEngine
  9. Python Set集合,函数,深入拷贝,浅入拷贝,文件处理
  10. IOS_Note
  11. 队列-&gt;队列的应用(银行业务模拟)
  12. j假设程序需要要一个int烈血的刀变量来保存1英里所包含的步数(5280)为该变量编写一条声明语句。
  13. Sitecore系统教程即时查阅编辑内容
  14. Notes of Daily Scrum Meeting(12.24)
  15. WebStorm中配置node.js(Windows)
  16. Python--函数对象@命名空间与作用域@包函数@装饰器@迭代器@内置函数
  17. Redis系列二:reids介绍
  18. Android ViewDragHelper全然解析 自己定义ViewGroup神器
  19. C# GDI绘制波形图
  20. [作业] Python入门基础--三级菜单

热门文章

  1. git开发实战:问题解决
  2. SSDT and Shadow SSDT table
  3. 洛谷P3366 【模板】最小生成树(LCT)
  4. [USACO 07NOV]电话线Telephone Wire
  5. upc组队赛16 GCDLCM 【Pollard_Rho大数质因数分解】
  6. 解决MVC中textarea出现多余空格的问题
  7. C#设计模式:状态者模式(State Pattern)
  8. MVC的布局页,视图布局页和分布页的使用
  9. 四、附加到进程调试(.NET Framework)
  10. 使用intellij的idea集成开发工具中的git插件(转)