2015-基础(7)

I - I

Description

“Point, point, life of student!”

This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the rules which are used in this course.

There are 5 problems in this final exam. And I will give you 100 points if you can solve all 5 problems; of course, it is fairly difficulty for many of you. If you can solve 4 problems, you can also get a high score 95 or 90 (you can get the former(前者) only
when your rank is in the first half of all students who solve 4 problems). Analogically(以此类推), you can get 85、80、75、70、65、60. But you will not pass this exam if you solve nothing problem, and I will mark your score with 50.

Note, only 1 student will get the score 95 when 3 students have solved 4 problems.

I wish you all can pass the exam!

Come on!

Input

Input contains multiple test cases. Each test case contains an integer N (1<=N<=100, the number of students) in a line first, and then N lines follow. Each line contains P (0<=P<=5 number of problems that have been solved) and T(consumed
time). You can assume that all data are different when 0<p.

A test case starting with a negative integer terminates the input and this test case should not to be processed.

Output

Output the scores of N students in N lines for each case, and there is a blank line after each case.

Sample Input

 4
5 06:30:17
4 07:31:27
4 08:12:12
4 05:23:13
1
5 06:30:17
-1 

Sample Output

 100
90
90
95

100 
#include <iostream>
using namespace std;
int main ()
{
	int n,i,j;
	char b[110];
	while(cin >> n)
	{
		long long a[110]={0},c[110]={0},e[110]={0};
		int q[5]={0};
		if(n==-1)
		{
			break;
		}
		for(i=0;i<n;++i)
		{
			cin >> c[i];
			if(c[i]==4)
			{
				q[4]++;
			}
			if(c[i]==3)
			{
				q[3]++;
			}
			if(c[i]==2)
			{
				q[2]++;
			}
			if(c[i]==1)
			{
				q[1]++;
			}
			cin >> b;
			for(j=0;b[j]!='\0';++j)
			{
				if(b[j]!=':')
				{
					a[i]+=b[j]-'0';
				}
				a[i]*=10;
			}
		}
		q[4]/=2;
		q[3]/=2;
		q[2]/=2;
		q[1]/=2;
		for(i=0;i<n;++i)
		{
			for(j=0;j<n;++j)
			{
				if(c[i]==4)
				{
					if(a[i]>a[j]&&c[j]==4)
				  {
					  e[i]++;
				  }
				}
			    else if(c[i]==3)
				{
					if(a[i]>a[j]&&c[j]==3)
				  {
					  e[i]++;
				  }
				}
				 else if(c[i]==2)
				{
					if(a[i]>a[j]&&c[j]==2)
				  {
					  e[i]++;
				  }
				}
				 else if(c[i]==1)
				{
					if(a[i]>a[j]&&c[j]==1)
				  {
					  e[i]++;
				  }
				}
			}
		}
	/*	for(i=0;i<n;i++)
		{
			cout << e[i]+1 << endl;
		}*/
		for(i=0;i<n;i++)
		{
			if(c[i]==5)
			{
				cout << 100 << endl;
			}
			else if(c[i]==0)
			{
				cout << 50  << endl;
			}
			else if(c[i]==4)
			{
				if(e[i]+1>q[4])
				  {
					  cout << 90  << endl;
				  }
				else
				{
					cout << 95  << endl;
				}
			}
			else if(c[i]==3)
			{
				 if(e[i]+1>q[3])
				  {
					  cout << 80 << endl;
				  }
				else
				{
					cout << 85 << endl;
				}
			}
			else if(c[i]==2)
			{
				 if(e[i]+1>q[2])
				  {
					  cout << 70 << endl;
				  }
				else
				{
					cout << 75  << endl;
				}
			}
			else if(c[i]==1)
			{
				 if(e[i]+1>q[1])
				  {
					  cout << 60 << endl;
				  }
				else
				{
					cout << 65 << endl;
				}
			}
		}
		cout << endl;
	}
	return 0;
}
时间: 2024-11-26 12:41:09

2015-基础(7)的相关文章

Java工程师笔试题整理[校招篇]

隔着两个月即将开始校招了.你是不是也想借着这个机会崭露头角,拿到某些大厂的offer,赢取白富美.走上人生巅峰?当然如果你还没能打下Java基础,一定要先打好Java基础:如何一步一步的学Java - 学习编程 - 知乎专栏.然后再来看一下练习一下各大厂的面试笔试题目. 如果以下内容满足不了你,你还可以去看这篇: 2016校招编程题汇总 - 学习编程 - 知乎专栏 进入主要内容(主要内容整理来自牛客网:牛客网)(以下内容按照各大公司进行划分,对每一公司按照年份进行划分,如果想想下载以下内容,可以

阿尔红军我让我特我问题沃特尔行业

http://www.houzz.com/ideabooks/38419124/thumbs/2015.01.04 http://www.houzz.com/ideabooks/38419135/thumbs/2015.01.04 http://www.houzz.com/ideabooks/38419147/thumbs/2015.01.04 http://www.houzz.com/ideabooks/38419107/thumbs/2015.01.04 http://www.houzz.c

哪敢跟学长这么

不少人面庞上有不由得惊呼出声http://weibo.com/09.16/2015/p/1001603887569338240338http://weibo.com/09.16/2015/p/1001603887569338268443http://weibo.com/09.16/2015/p/1001603887569342462767http://weibo.com/09.16/2015/p/1001603887569342462769http://weibo.com/09.16/2015/

右手缓缓握拢而

火红烈日炸裂的一路冲杀进去吧http://weibo.com/2015/09/16/p/1001603887216807041204http://weibo.com/2015/09/16/p/1001603887216811186273http://weibo.com/2015/09/16/p/1001603887216811186277http://weibo.com/2015/09/16/p/1001603887216811235528http://weibo.com/2015/09/16/

叶轻灵苦笑一声

灵光刚刚收起时灵兵潮流尽数的牧尘准备不错http://weibo.com/2015.09.16/p/1001603887492385369004http://weibo.com/2015.09.16/p/1001603887492389563376http://weibo.com/2015.09.16/p/1001603887492393757752http://weibo.com/2015.09.16/p/1001603887492397975161http://weibo.com/2015.

百度是否会骄傲是罚款撒家乐福

http://www.ebay.com/cln/koyche_0293/-/167468813012/2015.02.10 http://www.ebay.com/cln/x_l0513/-/167468823012/2015.02.10 http://www.ebay.com/cln/lhu9368/-/167461855010/2015.02.10 http://www.ebay.com/cln/lonb759/-/167364514017/2015.02.10 http://www.eba

百度的说法矿石结晶发神经

http://www.ebay.com/cln/zhay285/cars/167540455015/2015.02.09 http://www.ebay.com/cln/j-nen73/cars/167540456015/2015.02.09 http://www.ebay.com/cln/jin.p82/cars/167427490013/2015.02.09 http://www.ebay.com/cln/x-x6813/cars/167540459015/2015.02.09 http:/

百度得换个房间是否可使肌肤

http://www.ebay.com/cln/fenxi76/cars/167208337017/2015.02.09 http://www.ebay.com/cln/becn195/cars/167283623014/2015.02.09 http://www.ebay.com/cln/sh.sho7/cars/167306609010/2015.02.09 http://www.ebay.com/cln/zhji215/cars/167208345017/2015.02.09 http:/

百度恢复健康撒谎房间撒开了家发牢骚家乐福

http://www.ebay.com/cln/penya71/book/167561481013/2015.02.08 http://www.ebay.com/cln/lan-y87/book/167515536016/2015.02.08 http://www.ebay.com/cln/razan09/book/167561485013/2015.02.08 http://www.ebay.com/cln/jixia78/book/167678907015/2015.02.08 http:/

百度福建客户是否将失联客机法拉盛

http://www.ebay.com/cln/zudon36/book/167336542017/2015.02.08 http://www.ebay.com/cln/cefa050/book/167707562015/2015.02.08 http://www.ebay.com/cln/bicn417/book/167440260012/2015.02.08 http://www.ebay.com/cln/zhu-s31/book/167236817019/2015.02.08 http:/