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. sass 常用用法笔记

    最近公司开发的h5项目,需要用到sass,所以领导推荐让我去阮一峰大神的SASS用法指南博客学习,为方便以后自己使用,所以在此记录. 一.代码的重用 1.继承:SASS允许一个选择器,继承另一个选择器 ...

  2. Synplify FPGA 逻辑综合

    作为 Synopsys FPGA 设计解决方案的一部分,Synplify FPGA 综合软件是实现高性能.高性价比的 FPGA 设计的行业标准. 其独特的行为提取综合技术 (Behavior Extr ...

  3. leetcode_41. First Missing Positive_cyclic swapping

    https://leetcode.com/problems/first-missing-positive/ 给定一个长度为len的无序数组nums,找到其第一个丢失的正整数. 解法: 使用cyclic ...

  4. project .mpp 查看当天工作任务 1.选择自己 2.选择起始和终止时间 就显示当天的任务了

    project .mpp 查看当天工作任务 1.选择自己 2.选择起始和终止时间 就显示当天的任务了

  5. struct获取不到值的小错误

    struct2 get set 这两个方法一定要用双骆驼命名法:getA() setA(),        而geta() seta()不行 我找了好久的错误,只能说框架这东西快捷方便,找起错误要人命

  6. MySQL中外键删除、更新

      MySQL支持外键的存储引擎只有InnoDB..在创建外键的时候,可以指定在删除.更新父表时,对子表进行的相应操作,包括RESTRICT.NO ACTION.SET NULL和CASCADE. 其 ...

  7. iOS 6 的 Smart App Banners 介绍和使用

    iOS 6 的 Smart App Banners 介绍和使用 Denis 留言: 10 浏览:4890 文章目录[隐藏] 什么是 Smart App Banners 在你的网站添加 Smart Ap ...

  8. html5新增的定时器requestAnimationFrame

    在requestAnimationFrame出现之前,我们一般都用setTimeout和setInterval,那么html5为什么新增一个requestAnimationFrame,他的出现是为了解 ...

  9. 利用JS动态生成隔行换色HTML表格

    用JS生成动态生成表格,行.列由用户输入,并使表格隔行换色 方法一. 代码: <!DOCTYPE html> 2 <html> 3 <head> 4 <tit ...

  10. openjudge-1664 放苹果

    总时间限制: 1000ms 内存限制: 65536kB 描述 把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法. 输 ...