|
|
вернуться в форумThose whot got wa int test case 2.look at here #include<bits/stdc++.h> using namespace std; int main(){ int t; cin >> t; while(t--){ string s; cin >> s; int a = int(s[1] - 48); if(s[0]=='a' ||s[0]=='h'){ if(a==1 ||a==8) cout << 2 << endl; else if(a==2||a==7) cout << 3 << endl; else if(a>2) cout << 4 << endl; } else if(s[0]=='b'||s[0]=='g'){ if (a == 1 || a==8) cout << 3 << endl; else if (a == 2|| a==7) cout << 4 << endl; else if (a > 2) cout << 6 << endl; } else{ if (a == 1|| a==8) cout << 4 << endl; else if (a == 2|| a==7) cout << 6<< endl; else if (a > 2) cout << 8<< endl; } } } |
|
|