[模拟][YandexAlgorithm2013T1]Ancient Basketball
来源:互联网 发布:网络视频直播软件 编辑:程序博客网 时间:2024/05/16 13:38
Ancient Basketball
Time limit2 secondsMemory limit256MbInputstdinOutputstdoutLegend
A few days ago, Byteland archaeologists found the scoreboard of the very first basketball game in Byteland. Because of the historical significance of the event Bytelanders want to reconstruct the results.
It is known that Byteland rules of basketball are similar to basketball rules nowadays:
- team earns 1 point for each goal scored from a free throw;
- team earns 2 points for a field goal;
- team earns 3 points for a goal scored from behind the three-point line.
It is also known that, if the distance between the hoop and the player who scored the goal does not exceedL, then the goal counts as a field goal. Otherwise, it counts as a three-point throw. Archaeologists ask you to find out the result of the game based on the information about scored goals.
Input format
First line of input contains two integers n (1 ≤ n ≤ 1000) andL (1 ≤ L ≤ 30): the number of recorded scored balls and the distance from the hoop to the three-point line.
Each of the n next lines contains two integer numbersti (1 ≤ ti ≤ 2) anddi (-1 ≤ di ≤ 50). Ifdi ≥ 0 then player from the team ti scored a goal from distance di. Ifdi = -1, player from team ti scored a goal from a free throw.
Output format
In the only line of output, print the result of the game: the number of points earned by first team and the number of score points earned by second team. Separate the numbers by a colon.
Sample 1
3 51 22 51 10
5:2
Sample 2
4 101 21 -11 201 20
9:0
#include <cstdio>int score[3];int main(){int n,l;scanf("%d%d",&n,&l);for (int i=1;i<n+1;i++){int t,d;scanf("%d%d",&t,&d);if (d == -1)score[t] ++;else if (d <= l)score[t] += 2;elsescore[t] += 3;}printf("%d:%d",score[1],score[2]);return 0;}
- [模拟][YandexAlgorithm2013T1]Ancient Basketball
- HDU 3969 Crazy Basketball Fan 模拟
- HDU 5556 Ancient Go 模拟
- HDU 5556 Ancient Go 模拟
- Ancient Go(模拟+搜索)
- CodeForces 493C Vasya and Basketball(模拟 + 二分)
- NEERC 2004 / UVa 1339 Ancient Cipher (模拟)
- POJ 2159 : Ancient Cipher - 密码模拟
- CodeForces 260B Ancient Prophesy 模拟
- HDU 3069 Ancient Printer (模拟)
- hdu 5546 Ancient Go(bfs+模拟)
- codeforces 493C Vasya and Basketball (枚举+模拟+思维)
- basketball vocabulary
- sgu165:Basketball
- Basketball English
- Play Basketball
- Basketball Gym
- Basketball Gym
- 5.5 深入理解持久化对象:(5.5.1)持久化类的要求
- 反向条件式投注规则
- C++设置输出小数位数方法
- js实现弹层
- [Oracle] Data Guard CPU/PSU补丁安装教程
- [模拟][YandexAlgorithm2013T1]Ancient Basketball
- [模拟][YandexAlgorithm2013T2]Prime Problem
- 5.5 深入理解持久化对象:(5.5.2)持久化对象的状态
- poj 1006 Biorhythms 中国剩余定理
- POJ 3322 Bloxorz I (bfs+辅助数组+状态压缩+自己的一些搜索理解)
- TTTileffff2st
- hdu 1788 Chinese remainder theorem again 多个数的最小公倍数
- 开卷有益——我的读书经历
- Leetcode: Convert Sorted List to Binary Search Tree