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 ...
随机推荐
- CF385C Bear and Prime Numbers
思路: 需要对埃氏筛法的时间复杂度有正确的认识(O(nlog(log(n)))),我都以为肯定超时了,结果能过. 实现: #include <bits/stdc++.h> using na ...
- 【学习笔记】深入理解js原型和闭包系列学习笔记——精华
深入理解js原型和闭包笔记: 1.“一切皆是对象”,对象是属性的集合. 丨 函数也是对象,但是使用typeof时为什么函数返回function而 丨 不是object呢,js为何要对函数做这样的区分 ...
- 【学习笔记】深入理解js原型和闭包(5)——instanceof
又介绍一个老朋友——instanceof. 对于值类型,你可以通过typeof判断,string/number/boolean都很清楚,但是typeof在判断到引用类型的时候,返回值只有object/ ...
- elasticsearch 2.4.0安装说明
首先从官网下载安装包,是个压缩文件,然后解压 在es目录下找到es的配置文件 修改集群(cluster)名称 PS:一般情况下一台机只部署一个es程序,也就是一个集群,默认集群名是ewater_mai ...
- Oracle 11g r2 Enterprise Manager (EM) 中文页面调整为英文页面
Oracle 11g r2 Enterprise Manager (EM) 在中文语言环境下, 部分功能(如包含时间的查询数据库实例: orcl > 指导中心 > SQL 优化概要 ...
- css广告弹窗满屏跑
window.onload=function(){ //广告滚动 var oneInner = $('#divid')[0]; //定时器 var a1a = setInterval(moves,10 ...
- SQLite -创建表
SQLite -创建表 SQLite CREATE TABLE语句用于创建一个新表在任何给定的数据库.创建一个基本表包括表命名和定义其列,每列的数据类型 语法: CREATE TABLE语句的基本语法 ...
- JavaFX Chart设置数值显示
一.XYChart import javafx.application.Application;import javafx.geometry.NodeOrientation;import javafx ...
- JavaScript-条件循环
JavaScript-条件循环 条件判断语句 if 语句 - 只有当指定条件为 true 时,使用该语句来执行代码 if (表达式){ 当条件为 true 时执行的代码} if...else 语 ...
- Python3基础教程(二十)—— flask介绍
基本概念 什么是Flask? Flask 是一个 web 框架.也就是说 Flask 为你提供工具,库和技术来允许你构建一个 web 应用程序.这个 web 应用程序可以是一些 web 页面.博客.w ...