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的更多相关文章

  1. 【codeforces 750B】New Year and North Pole

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  2. 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 ...

  3. Good Bye 2016

    A - New Year and Hurry (water) #include <bits/stdc++.h> using namespace std; int main() { ]; ; ...

  4. Inverted sentences

    And ever has it been that love knows not its own depth until the hour of separation.  除非临到了别离的时候,爱永远 ...

  5. ural 1341. Device

    1341. Device Time limit: 1.0 secondMemory limit: 64 MB Major (M): You claimed that your device would ...

  6. News common vocabulary

    英语新闻常用词汇与短语 经济篇 accumulated deficit 累计赤字 active trade balance 贸易顺差 adverse trade balance 贸易逆差 aid 援助 ...

  7. 越狱Season 1- Episode 16

    Season 1, Episode 16 -Burrows:Don't be. It's not your fault. 不要,不是你的错 -Fernando: Know what I like? 知 ...

  8. vacabulary1

    The hard hat is rigid,so nothing will hurt my head. glue 胶水vegetarian 素食者: 素食主义者:素食的 North Korea 朝鲜S ...

  9. esriSRProjCS3Type Constants

    ArcGIS Developer Help  (Geometry)   esriSRProjCS3Type Constants See Also esriSRProjCSType Constants ...

随机推荐

  1. Java_面向对象中的this和super用法

    this: 1.使用在类中,可以用来修饰属性.方法.构造器 2.表示当前对象或者是当前正在创建的对象 3.当形参与成员变量重名时,如果在方法内部需要使用成员变量,必须添加 this 来表明该变量时类成 ...

  2. ssm(Spring、Springmvc、Mybatis)实战之淘淘商城-第六天(非原创)

    文章大纲 一.课程介绍二.今日内容简单介绍三.Httpclient介绍与实战四.项目源码与资料下载五.参考文章   一.课程介绍 一共14天课程(1)第一天:电商行业的背景.淘淘商城的介绍.搭建项目工 ...

  3. Maven项目中War包的打包及依赖方式

    两个web项目之间的依赖引用方式.Web项目之间,通过war包的方式进行引用的.例如,有两个项目,puzzle-web和puzzle-web-demo,两个均是web项目,puzzle-web-dem ...

  4. iOS开发之cell位置contentOffset的用法

    @property(nonatomic)         CGPoint                      contentOffset;                  // default ...

  5. 洛谷 P2894 [USACO08FEB]酒店Hotel

    题目描述 The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a ...

  6. raid 0 1 5 10 总结的知识点

    raid 0 1 5 10 raid 发的别名条带 raid 0 读取性能最高需要磁盘2*N个(N>0)代表所有raid级别中的最高存储性能,其实原理就是把连续的数据分散到多个磁盘上存取,这样, ...

  7. PHP02 PHPStrom2018.X与WAMPServer3.0.6的集成

    脚本运行环境设置:设置PHPStorm中的脚本在PHP解析器上运行 1.进入Filie>>>setting>>languages and FrameWorks 选择php ...

  8. JavaSE-01 认识Java

    01  认识Java 学习要点 程序的概念 Java技术内容 使用记事本开发简单的java程序 使用输出语句在控制台输出信息 熟悉Eclipse开发环境 程序的概念 源自生活 例如五一节计划:春光明媚 ...

  9. mysql数据库优化 几个思路

    建表: 合理的索引, 组合索引 合理的字段类型 合理的表结构和表关联关系 查询: 避免: *,  函数 , 计算 , like左右全匹配  , in ,  beteewn??  索引和组合索引 子查询 ...

  10. java 图片合成文字或者awt包下的对话框引入自定义字体库

    成就卡图片字体问题:1.下载 xxx.ttf 文件2.mkdir /usr/local/jdk1.6.0_11/jre/lib/fonts/fallback.     在jre/lib/fonts 下 ...