| ||||||||||
| 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 POJ 1013(水题)谢谢#include<iostream>
#include<string>
#define N 15
using namespace std;
int main()
{
int n;
char get[3][3][N];
int check[12]={0};
cin>>n;
while(n--)
{
for(int i=0;i<3;i++)
{
for(int j=0;j<3;j++)
cin>>get[i][j];
if(get[i][2][0]=='e')
{
int len=strlen(get[i][0]);
for(int s=0;s<2;s++)
for(int k=0;k<len;k++)
check[get[i][s][k]-'A']=1;
}
}
for(int i=0;i<3;i++)
if(get[i][2][0]=='u')
{
int len=strlen(get[i][0]);
for(int j=0;j<2;j++)
for(int k=0;k<len;k++)
if(check[get[i][j][k]-'A']==0)
{
if(j==0)
cout<<get[i][j][k]<<" is the counterfeit coin and it is heavy."<<endl;
else
cout<<get[i][j][k]<<" is the counterfeit coin and it is light."<<endl;
}
}
for(int i=0;i<3;i++)
if(get[i][2][0]=='d')
{
int len=strlen(get[i][0]);
for(int j=0;j<2;j++)
for(int k=0;k<len;k++)
if(check[get[i][j][k]-'A']==0)
{
if(j==0)
cout<<get[i][j][k]<<" is the counterfeit coin and it is light."<<endl;
else
cout<<get[i][j][k]<<" is the counterfeit coin and it is heavy."<<endl;
}
}
}
system("pause");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator