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 ...
随机推荐
- 学JAVA第二十四天,Set集合与StringBuilder
下面的内容需要慢慢看,因为,我的语言表达能力不是很好 首先说Set把,Set集合是一个无序且不允许重复的集合,而且查找效率也是快的可怕的. 但是,有些时候,我们必须要用储存多个相同的值时,Set也是可 ...
- intellij idea 调试 lua程序, 突然崩溃或者xmx不够的情况
将内存各方面的数值都改大一点.都什么时代了,默认数值还这么低... -server-Xms256m-Xmx1024m-XX:ReservedCodeCacheSize=240m-XX:+UseConc ...
- 【学习笔记】深入理解js原型和闭包(13)——【作用域】和【上下文环境】
上文简单介绍了作用域,本文把作用域和上下文环境结合起来说一下,会理解的更深一些. 如上图,我们在上文中已经介绍了,除了全局作用域之外,每个函数都会创建自己的作用域,作用域在函数定义时就已经确定了.而不 ...
- oracle适配器连接不上解决方案
Oracle适配器连接不上解决方案 作者:Vashon oracle 的Developer连接不上报错:listener does not currently know of SID given in ...
- 原生JS--各种兼容性写法总结
<script> var oEvent = evt || event; ========================================================== ...
- JVM 内存区域方面的面试题
https://mp.weixin.qq.com/s/TpCElutqVSt7PAzjrGz12w 写在前面(常见面试题) 基本问题 •介绍下 Java 内存区域(运行时数据区)•Java 对象的创建 ...
- Format a Hard Drive in Csharp
Article Author(s): Audric Thevenet All Rights Reserved. Here's how to format hard drives, floppies, ...
- C ++ _基础之共用体
由以下代码来进一步学习共用体 #include <stdio.h> #include<iostream> void main() { union un { int a; cha ...
- manjaro利用docker使用MySQL
使用docker安装MySQL并使用 安装docker: sudo yaourt -S docker 使用docker安装mysql: systemctl start docker # 启动docke ...
- avalon转成Vue
需求: 旧项目中有部分页面是用avalon写的,avalon存在页面刷新,会出现重复行的问题,数组渲染出现重复行bug, 需要转成vue 总结 记录了一下大概需要改的地方 1. avalon中的ms- ...