Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

呜呜,虽然水,还是wa了好多次,现在才知道有公式

Posted by TSERROF at 2012-11-01 23:44:36 on Problem 3117
#include<iostream>
#include <string>
using namespace std;
int T,N;
int main()
{
	while(cin>>T>>N && T )
	{
		string t_name;
		long long sum=0,scores;
		long long ans=0;
		for(int i=1;i<=T;++i){ cin>>t_name>>scores;sum+=scores;}
		for(ans=0;sum && ans<=N;++ans)if((N-ans)*3+ans*2==sum || ans*2==sum){sum=0;break;}
		cout<<ans<<endl;
	}
	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator