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 n,i,j,k; string card[12]; char count[3]={'1','2','3'}; char symbol[3]={'D','O','S'}; char color[3]={'R','G','P'}; char shading[3]={'O','F','S'}; int main () { while (cin>>card[0]) { for (i=1;i<12;i++) cin>>card[i]; cout<<"CARDS: "; for (i=0;i<12;i++) cout<<card[i]<<" "; cout<<endl; cout<<"SETS: "; int flagset=0;//set exist// n=1; for (i=0;i<10;i++) for (j=i+1;j<11;j++) { string temp; if(card[i][0]==card[j][0]) temp+=card[i][0]; else { for (k=0;k<3;k++) if (symbol[k]!=card[i][0]&&symbol[k]!=card[j][0]) break; temp+=symbol[k]; } if (card[i][1]==card[j][1]) temp+=card[i][1]; else { for (k=0;k<3;k++) if (count[k]!=card[i][1]&&count[k]!=card[j][1]) break; temp+=count[k]; } if (card[i][2]==card[j][2]) temp+=card[i][2]; else { for (k=0;k<3;k++) if (color[k]!=card[i][2]&&color[k]!=card[j][2]) break; temp+=color[k]; } if (card[i][3]==card[j][3]) temp+=card[i][3]; else { for (k=0;k<3;k++) if (shading[k]!=card[i][3]&&shading[k]!=card[j][3]) break; temp+=shading[k]; } for (k=j+1;k<12;k++) if (temp==card[k]) { flagset=1; cout<<n++<<". "<<card[i]<<" "<<card[j]<<" "<<temp<<endl; cout<<" "; } } if (!flagset) cout<<"*** None Found ***"<<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