goodbye 2016 B New Year and North Pole
2017-01-12 21:10
447 查看
点击打开链接
水题,我却错了一大堆,,,,
欸,,没看懂题,我以为站在南极,其他任意方向都是向北,所以这样写GG了,
结果是只要判断指示是否完全正确,一旦不合常理,就算完蛋。
欧,,,天啊,炸了。
#include <bits/stdc++.h>
using namespace std;
int main(){
int T,n,ans=0,f=1;
char arr[10];
scanf("%d",&T);
while(T--){
scanf("%d %s",&n,arr);
if((ans==0&&arr[0]!='S')||(ans==20000&&arr[0]!='N')) f=0;
if(arr[0]=='N') ans-=n;
if(arr[0]=='S') ans+=n;
if(ans<0||ans>20000) f=0;
}
if(ans!=0||f==0) printf("NO\n");
else printf("YES\n");
return 0;
}
水题,我却错了一大堆,,,,
欸,,没看懂题,我以为站在南极,其他任意方向都是向北,所以这样写GG了,
结果是只要判断指示是否完全正确,一旦不合常理,就算完蛋。
欧,,,天啊,炸了。
#include <bits/stdc++.h>
using namespace std;
int main(){
int T,n,ans=0,f=1;
char arr[10];
scanf("%d",&T);
while(T--){
scanf("%d %s",&n,arr);
if((ans==0&&arr[0]!='S')||(ans==20000&&arr[0]!='N')) f=0;
if(arr[0]=='N') ans-=n;
if(arr[0]=='S') ans+=n;
if(ans<0||ans>20000) f=0;
}
if(ans!=0||f==0) printf("NO\n");
else printf("YES\n");
return 0;
}
相关文章推荐
- codeforces Good Bye 2016-B New Year and North Pole
- CodeFroces--Good Bye 2016-B--New Year and North Pole(水题-模拟)
- 【Goodbye 2016】 D. New Year and Fireworks【暴力+姿势剪枝】【今年最后一发题解了啊!】
- New Year and North Pole CodeForces - 750B
- 【codeforces 750B】New Year and North Pole
- New Year and North Pole
- codeforces goodbye 2016 C. New Year and Rating
- New Year and North Pole
- E - New Year and North Pole CodeForces - 750B(状态处理下就好了)
- 【Codeforces 750 B New Year and North Pole 】+ 手速
- GoodBye 2016 C. New Year and Rating 详解(维护不等式)
- B. New Year and North Pole
- Good Bye 2016 C. New Year and Rating(二分)
- CodeForces Good Bye 2016 :C New Year and Rating、D New Year and Fireworks、E New Year and Old Subsequ
- codeforces Good Bye 2016-D New Year and Fireworks(dfs)
- Codeforces Good Bye 2016 D. New Year and Fireworks(bfs/dfs)
- codeforces GoodBye2015 D.New Year and Ancient Prophecy (dp+lcp+树状数组)
- Codeforces Good Bye 2016 C. New Year and Rating(模拟)
- Good Bye 2016 C. New Year and Rating(模拟)
- CodeFroces--Good Bye 2016-A-New Year and Hurry(水题-模拟)