|
|
back to boardTest #1? Whats wrong with my code? #include<iostream> #include<cstring> #include<cmath> using namespace std; int main(){ string st; int W,n,i=0,A[1000]; cin >> n; do{ cin >> st; if(((int)st[0]==65)||((int)st[0]==80)||((int)st[0]==79)||((int)st[0]==82)) A[i]=1; if(((int)st[0]==66)||((int)st[0]==77)||((int)st[0]==83)) A[i]=2; if(((int)st[0]==68)||((int)st[0]==71)||((int)st[0]==74)||((int)st[0]==75)||((int)st[0]==84)||((int)st[0]==87)) A[i]=3; i++; }while(i<n); for(i=0;i<n-1;i++) { int S; S=abs(A[i]-A[i+1]); W+=S; } cout<<W; return 0; } Please,help me!!! Re: Test #1? Whats wrong with my code? Edited by author 06.05.2016 18:42 |
|
|