| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
呜呜,虽然水,还是wa了好多次,现在才知道有公式#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator