[模拟][YandexAlgorithm2013T1]Ancient Basketball

Ancient Basketball

Time limit2 seconds
Memory limit256Mb
Inputstdin
Outputstdout

Legend

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 exceed L, 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) and L (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 numbers ti (1 ≤ ti ≤ 2) and di (-1 ≤ di ≤ 50). If di ≥ 0 then player from the team ti scored a goal from distance di. If di = -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

InputOutput
3 5
1 2
2 5
1 10
5:2

Sample 2

InputOutput
4 10
1 2
1 -1
1 20
1 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;
		else
			score[t] += 3;
	}
	printf("%d:%d",score[1],score[2]);
	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值