CodeForces - 750B New Year and North Pole
http://codeforces.com/problemset/problem/750/B
模拟题
审题 在南极点 只能向北走(不能向 南 东 西) 所以也就不存在走过南极点的情况 北极点同样
然后去模拟那个走的过程 不符合条件就fail即可
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std; int n;
int main()
{
freopen("in.txt" ,"r", stdin);
scanf("%d", &n);
long long len;
char dir[];
long long Loc = ;
bool fail = false;
while (n--)
{
memset(dir, , sizeof(dir));
scanf("%lld", &len);
scanf("%s", dir);
getchar();
if (strcmp("South", dir) && Loc == )
{
fail = true;
break;
}
if (strcmp("North", dir) && Loc == )
{
fail = true;
break;
}
if (!strcmp(dir, "North"))
{
Loc += len;
}
if (!strcmp(dir, "South"))
{
Loc -= len;
}
if (Loc > || Loc < )
{
fail = true;
break;
}
}
if (fail)
{
printf("NO\n");
}
else
{
if (Loc == ) printf("YES\n");
else printf("NO\n");
}
return ;
}
CodeForces - 750B New Year and North Pole的更多相关文章
- 【codeforces 750B】New Year and North Pole
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- CodeFroces--Good Bye 2016-B--New Year and North Pole(水题-模拟)
B. New Year and North Pole time limit per test 2 seconds memory limit per test 256 megabytes input s ...
- Good Bye 2016
A - New Year and Hurry (water) #include <bits/stdc++.h> using namespace std; int main() { ]; ; ...
- Inverted sentences
And ever has it been that love knows not its own depth until the hour of separation. 除非临到了别离的时候,爱永远 ...
- ural 1341. Device
1341. Device Time limit: 1.0 secondMemory limit: 64 MB Major (M): You claimed that your device would ...
- News common vocabulary
英语新闻常用词汇与短语 经济篇 accumulated deficit 累计赤字 active trade balance 贸易顺差 adverse trade balance 贸易逆差 aid 援助 ...
- 越狱Season 1- Episode 16
Season 1, Episode 16 -Burrows:Don't be. It's not your fault. 不要,不是你的错 -Fernando: Know what I like? 知 ...
- vacabulary1
The hard hat is rigid,so nothing will hurt my head. glue 胶水vegetarian 素食者: 素食主义者:素食的 North Korea 朝鲜S ...
- esriSRProjCS3Type Constants
ArcGIS Developer Help (Geometry) esriSRProjCS3Type Constants See Also esriSRProjCSType Constants ...
随机推荐
- Json和序列化总结
一.序言 遇到问题,就经常逛园,不知你是否曾有,曾经遇到的问题,或者在园子里看到问题的方案,过一段时间,有可能还会摔跤,哈哈...大神请勿喷,小弟记忆不太好,还过来找资料,如果自己写把问题或某个知识点 ...
- AJPFX总结java开发常用类(包装,数字处理集合等)(三)
4.Map是一种把键对象和值对象进行关联的容器,而一个值对象又可以是一个Map,依次类推,这样就可形成一个多级映射.对于键对象来说,像Set一样,一 个Map容器中的键对象不允许重复,这是为了保持查找 ...
- [ AHOI 2013 ] 作业 & [ BZOJ 3809 ] Gty的二逼妹子序列
\(\\\) Description 给出一个长为 \(n\) 的数列 \(A\) 和 \(k\),多次询问: 对于一个区间 \([L_i,R_i]\),问区间内有多少个数在 \([a_i,b_i]\ ...
- scrollTop、offsetTop、clientTop
1.offsetTop: obj.offsetTop 指 obj 相对于版面或由 offsetParent 属性指定的父坐标的计算上侧位置. 2.clientTop: 这个返回的是元素周围边框的厚度, ...
- 【学习笔记】OSG中相机参数的更改
#pragma comment(lib, "osg.lib") #pragma comment(lib, "osgDB.lib") #pragma commen ...
- iOS 开发App捕获异常, 反馈给服务器, 提高用户体验
在我们开发的app中, 不可避免的, 有时候用户使用软件会崩溃. 我们就需要捕获异常, 可以在入口类中加入相应的代码, 可以在每次用户打开程序的时候, 检查一下沙盒中是否有崩溃日志, 如果有, 可以 ...
- 混合开发之DCloud和Weex的集成及优缺点比较
记录此文时太忙,没时间整理上来.需要请私信,由于DCloud和Weex的版本及API更新过快,本次分享只是对某个版本处理.
- function calling convention
这是2013年写的一篇旧文,放在gegahost.net上面 http://raison.gegahost.net/?p=31 February 19, 2013 function calling c ...
- Hadoop 常用命令之 HDFS命令
命令 说明 hadoop fs -mkdir 创建HDFS目录 hadoop fs -ls 列出HDFS目录 hadoop fs -copyFromLocal 使用-copyFromLocal 复制本 ...
- # Transition:添加弹出过渡效果
# Transition:添加弹出过渡效果 通过鼠标的单击.获得焦点,被点击或对元素任何改变中触发,并平滑地以动画效果改变CSS的属性值. W3C-transition MDN-transition ...