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. 【转】深入理解Android中的SharedPreferences

    SharedPreferences作为Android中数据存储方式的一种,我们经常会用到,它适合用来保存那些少量的数据,特别是键值对数据,比如配置信息,登录信息等.不过要想做到正确使用SharedPr ...

  2. ES-自然语言处理之中文分词器

    前言 中文分词是中文文本处理的一个基础步骤,也是中文人机自然语言交互的基础模块.不同于英文的是,中文句子中没有词的界限,因此在进行中文自然语言处理时,通常需要先进行分词,分词效果将直接影响词性.句法树 ...

  3. php 生成饼状图,折线图,条形图 通用类

    生成饼状图,折线图,条形图通用的php类,这里使用的是百度 Echart. Echart 官方网站  http://echarts.baidu.com/ <?php class Echarts ...

  4. Android利用已有控件实现自定义控件

    Android控件的基本介绍及使用自定义控件的意义         Android 本身提供了很多控件,自定义控件在android中被广泛运用,自定义控件给了我们很大的方便.比如说,一个视图为imag ...

  5. jacob的使用方法

    网上一大堆你抄我的,我抄你的,但基本配置都没说清,做个笔记让后来的人少走冤枉路 1.下载最新的jacob,jdk版本一一对应,1.6对应jacob的1.16,1.7对应1.17.... 2.应用程序将 ...

  6. web页面调用IOS的事件

    /** * js 调用ios的方法 * @param callback */ function connectWebViewJavascriptBridge(callback) { if (windo ...

  7. Qt学习笔记12:基本会话框4——总结

    文件对话框静态函数 QString QFileDialog::getOpenFileName{ QWidget *parent = 0; //标准文件对话框的父窗口 const QString &am ...

  8. select2宽度占比100%,导致无法实现浮动效果

  9. mybatis 实现批量更新

    更新单条记录 1 UPDATE course SET name = 'course1' WHERE id = 'id1'; 更新多条记录的同一个字段为同一个值 1 UPDATE course SET  ...

  10. [BZOJ3207]:花神的嘲讽(分块解法)

    题目传送门 题目描述:背景花神是神,一大癖好就是嘲讽大J,举例如下:“哎你傻不傻的![hqz:大笨J]”“这道题又被J屎过了!!”“J这程序怎么跑这么快!J要逆袭了!”…… 描述这一天DJ在给吾等众蒟 ...