记录编号 |
49976 |
评测结果 |
AAAAAAAAAAAAAAAAAAAA |
题目名称 |
[東方S1] 东风谷早苗 |
最终得分 |
100 |
用户昵称 |
cstdio |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.008 s |
提交时间 |
2012-11-10 16:00:30 |
内存使用 |
0.31 MiB |
显示代码纯文本
- #include<iostream>
- #include<cstdio>
- #include<cstring>
- #include<iomanip>
- #include<string>
- #include<algorithm>
- using namespace std;
- int main(){
- freopen("android.in","r",stdin);
- freopen("android.out","w",stdout);
- string s;
- char ch;
- long i=0,x=0,y=0,t,len,p=0,west=0,south=0,east=0,north=0;
- cin>>s>>t;
- len=s.size();
- while(i<len){
- ch=s[i];
- if(ch=='E') east++;
- else if(ch=='S') south++;
- else if(ch=='W') west++;
- else if(ch=='N') north++;
- i++;
- }
- long temp=t/len;
- x+=east*temp,x-=west*temp,y+=north*temp,y-=south*temp;
- t%=len,i=0;
- while(i<t){
- ch=s[i];
- if(ch=='E') x++;
- else if(ch=='S') y--;
- else if(ch=='W') x--;
- else if(ch=='N') y++;
- i++;
- }
- printf("%d %d",x,y);
- return 0;
- }