|
|
back to boardWA #3 Why it is not working? #include<iostream> #include<string> using namespace std; int main() { int n,k=0; char t,s; cin>>n; string a[1001]; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<n-1;i++) { t=a[i][0]; s=a[i+1][0];
if((t=='A' || t=='P' || t=='O' || t=='R') && (s=='A' || s=='P' || s=='O' || s=='R')) k+=0; if((t=='A' || t=='P' || t=='O' || t=='R') && (s=='B' || s=='M' || s=='S')) k+=1; if((t=='A' || t=='P' || t=='O' || t=='R') && (s=='D' || s=='G' || s=='J' || s=='K' || s=='T' || s=='W')) k+=2;
if((t=='B' || t=='M' || t=='S') && (s=='B' || s=='M' || s=='S')) k+=0; if((t=='B' || t=='M' || t=='S') && (s=='A' || s=='P' || s=='O' || s=='R'|| s=='D' || s=='G' || s=='J' || s=='K' || s=='T' || s=='W')) k+=1;
if((t=='D' || t=='G' || t=='J' || t=='K' || t=='T' || t=='W') && (s=='D' || s=='G' || s=='J' || s=='K' || s=='T' || s=='W')) k+=0; if((t=='D' || t=='G' || t=='J' || t=='K' || t=='T' || t=='W') && (s=='B' || s=='M' || s=='S')) k+=1; if((t=='D' || t=='G' || t=='J' || t=='K' || t=='T' || t=='W') && (s=='A' || s=='P' || s=='O' || s=='R')) k+=2; }
cout<<k; return 0; } Re: WA #3 Why it is not working? 1 Dumbo --->>> is not working Re: WA #3 Why it is not working? Right Answer is 2 but your answer 0 |
|
|