upc组队赛3 Chaarshanbegaan at Cafebazaar

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;
 
}
posted @ 2019-04-07 13:20  llke  阅读(148)  评论(0编辑  收藏  举报