| ||||||||||
| 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:救命啊!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!In Reply To:救命啊!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Posted by:beijing2008 at 2006-05-10 00:56:35 > #include<stdio.h>
> #include<iostream.h>
> #include<memory.h>
> #include<math.h>
> int main()
> {
> int real[12],yi[12];char a[3][4],b[3][4],pan[3][5];
> int i,j,num,k,p;
> scanf("%d",&num);
> while(num--);
> {
> memset(real,0,sizeof(real));memset(yi,0,sizeof(yi));
> for(i=0;i<=2;i++)
> cin>>a[i]>>b[i]>>pan[i];
> for(i=0;i<=2;i++)
> {
> if(pan[i][0]=='e')
> {
> for(j=0;j<=3;j++)
> {
> real[a[i][j]-65]=1;
> real[b[i][j]-65]=1;
> }
> }
> if(pan[i][0]=='u')
> {
> for(j=0;j<=3;j++)
> {
> yi[b[i][j]-65]--;
> }
> }
> if(pan[i][0]=='d')
> {
> for(j=0;j<=3;j++)
> {
> yi[b[i][j]-65]++;
> }
> }
> }
> for(i=0;i<=11;i++)
> {
> if(real[i]==1)
> yi[i]=0;
> }
> k=0;
> for(i=0;i<=11;i++)
> {
> if(abs(yi[i])>k)
> {
> k=abs(yi[i]);
> j=i;
> }
> }
> if(yi[j]<0)
> cout<<char('A'+j)<<" is the counterfeit coin and it is light."<<endl;
> else
> cout<<char('A'+j)<<" is the counterfeit coin and it is 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