因为你用的int类型啊
by 语文公子 @ 2019-03-25 09:02:49
人品问题……
by 「❦」QAS @ 2019-03-25 09:36:07
```cpp
#include<bits/stdc++.h>
using namespace std;
int t,x1,x2,yy,y2;
int f;
int step=0;
int a[55][55];
int c,s;
char ans;
int main() {
memset(a,-1,sizeof(a));
cin>>x1>>yy>>x2>>y2>>t;
a[x1][yy]=1;
a[x2][y2]=3;
c=x2;
s=y2;
for(int k=1; k<=t; k++) {
cin>>ans;
if(ans=='E') {
if(c==x1&&s==yy) {
cout<<step;
return 0;
} else {
s--;
step++;
}
}
else if(ans=='W'){
if(c==x1&&s==yy){
cout<<step;
return 0;
} else{
s++;
step++;
}
}
else if(ans=='N'){
if(c==x1&&s==yy){
cout<<step;
return 0;
} else{
c++;
step++;
}
}
else if(ans=='S'){
if(c==x1&&s==yy){
cout<<step;
return 0;
} else{
c--;
step++;
}
}
}
cout<<"-1";
/*for(int k=1; k<=t; k++) {
cin>>ans;
for(int i=1; i<=54; i++) {
for(int j=1; j<=54; j++) {
if(ans=='E') {
if(a[c][s]==3) {
break;
cout<<step;
} else {
a[i][j+1]=2;
c=i;
s=j+1;
step++;
}
} else if(ans=='W') {
if(a[c][s]==3) {
break;
cout<<step;
} else {
a[i][j-1]=2;
c=i;
s=j-1;
step++;
}
} else if(ans=='N') {
if(a[c][s]==3) {
break;
cout<<step;
} else {
a[i-1][j]=2;
c=i-1;
s=j;
step++;
}
} else if(ans=='S') {
if(a[c][s]==3) {
break;
cout<<step;
} else {
a[i+1][j]=2;
c=i+1;
s=j;
step++;
}
}
}
}
}
cout<<"-1"<<endl;*/
return 0;
}
```
by Mono_pigsicklie @ 2019-03-25 09:46:57
嗯哼
by Mono_pigsicklie @ 2019-03-25 09:47:05