| ||||||||||
| 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 | |||||||||
为什么RE啊~~~谢谢啦#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
long t;
long _real[13],pd[13];
string st1,st2,st3;
long ans;
int main()
{
cin>>t;
for (long i=1;i<=t;i++)
{
for (long j=1;j<=12;j++) {_real[i]=0;pd[i]=0;}
for (long r=1;r<=3;r++)
{
cin>>st1>>st2>>st3;
if (st3=="even") for (long k=0;k<=3;k++) _real[st1[k]-64]=_real[st2[k]-64]=1;
else if (st3=="up") for (long k=0;k<=3;k++) {pd[st1[k]-64]--;pd[st2[k]-64]++;}
else for (long k=0;k<=3;k++) {pd[st1[k]-64]++;pd[st2[k]-64]--;}
}
for (long j=1;j<=12;j++)
if (_real[j]==1) pd[j]=0;
ans = 1;
for (long j=2;j<=12;j++)
if (fabs(pd[j])>fabs(pd[ans])) ans=j;
cout<<char(ans+64)<<" is the counterfeit coin and it is ";
if (pd[ans]>0) cout<<"light."<<endl;
else cout<<"heavy."<<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