题目大意:月亮从0到15,15下面是0、循环往复。给出n个数字,如果下一个数字大于第n个数字输出UP,小于输出DOWN,无法确定输出-1.

题目思路:给出0则一定是UP,给出15一定是DOWN,给出其他的一个数字(n==1)无法确定,其他的情况比较后两位。

 #include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<stdio.h>
#include<stdlib.h>
#include<queue>
#include<math.h>
#include<map>
#define INF 0x3f3f3f3f
#define MAX 1000005
#define Temp 1000000000 using namespace std; int a[MAX];
int main()
{
int n,op;
while(scanf("%d",&n)!=EOF)
{
for(int i=;i<=n;i++)
scanf("%d",&a[i]);
if(n==)
{
if(a[n]==)
op=-;
else if(a[n]==)
op=;
else
op=;
}
else
{
if(a[n]==)
op=-;
else if(a[n]==)
op=;
else if(a[n] > a[n-])
op=;
else if(a[n] < a[n-])
op=-;
}
if(op==)
printf("-1\n");
else if(op==)
printf("UP\n");
else
printf("DOWN\n");
}
return ;
}

CodeForces 719A Vitya in the Countryside 思维题的更多相关文章

  1. CodeForces 719A Vitya in the Countryside (水题)

    题意:根据题目,给定一些数字,让你判断是上升还是下降. 析:注意只有0,15时特别注意一下,然后就是14 15 1 0注意一下就可以了. 代码如下: #pragma comment(linker, & ...

  2. codeforces 719A Vitya in the Countryside(序列判断趋势)

    题目链接:http://codeforces.com/problemset/problem/719/A 题目大意: 题目给出了一个序列趋势 0 .1 .2 .3 ---14 .15 .14 ----3 ...

  3. CodeForces 719A. Vitya in the Countryside

    链接:[http://codeforces.com/group/1EzrFFyOc0/contest/719/problem/A] 题意: 给你一个数列(0, 1, 2, 3, 4, 5, 6, 7, ...

  4. Codeforces Round #373 (Div. 2) A. Vitya in the Countryside 水题

    A. Vitya in the Countryside 题目连接: http://codeforces.com/contest/719/problem/A Description Every summ ...

  5. Code forces 719A Vitya in the Countryside

    A. Vitya in the Countryside time limit per test:1 second memory limit per test:256 megabytes input:s ...

  6. Codeforces 718E - Matvey's Birthday(思维题)

    Codeforces 题面传送门 & 洛谷题面传送门 首先注意到这个图的特殊性:我们对于所有 \(s_i=s_j\)​ 的 \((i,j)\)​ 之间都连了条边,而字符集大小顶多只有 \(8\ ...

  7. Codeforces 643F - Bears and Juice(思维题)

    Codeforces 题目传送门 & 洛谷题目传送门 首先直接暴力枚举显然是不现实的,我们不妨换个角度来处理这个问题,考虑这 \(R_i\) 个瓶子中每一瓶被哪些熊在哪一天喝过. 我们考虑对这 ...

  8. Codeforces 627E - Orchestra(双向链表,思维题)

    Codeforces 题目传送门 & 洛谷题目传送门 下设 \(n,m\) 同阶. 首先有一个傻子都会的暴力做法,枚举矩形的上.下边界 \(l,r\),考虑集合多重集 \(S=\{y|x\in ...

  9. Codeforces Round #416 (Div. 2)(A,思维题,暴力,B,思维题,暴力)

    A. Vladik and Courtesy time limit per test:2 seconds memory limit per test:256 megabytes input:stand ...

随机推荐

  1. 关于百度地图API (持续跟新)

    一.初始化地图显示不在正中间,出现偏移 问题描述与解决办法: 代码: body, html, #allmap { width: 100%; height: 100%; overflow: hidden ...

  2. webstorm常用快捷键及(idea,phpstorm,android studio通用)使用技巧

    webstorm常用快捷键 ctrl+l 格式化代码 ctrl+shift+ -/+键   折叠/展开所有代码 打开file:ctrl+shift+n 打开一个类:ctrl+n 代码提示:Ctrl+a ...

  3. Bullet_Point_Py

    1. if __name__ == "__main__" Term: 模块最高级的代码:模块中没有缩进的代码 Principal 1: 第一次导入模块会执行模块最高级的代码.不管你 ...

  4. ubuntu 14.04 cagl

    libboost-atomic1.-dev libboost-atomic1.-dev libboost-chrono1.-dev libboost-dev libboost-program-opti ...

  5. fatal error RC1004: unexpected end of file found处理方法

    资源编译器错误 RC1004 错误消息 遇到意外的文件结束 此错误是由于文本文件的最后一行中缺少换行符和回车符而造成的.

  6. tomcat 7 启动超时设置。。。实在太隐蔽了

    打开Tomcat,选择 Window->Show View->Servers,在主窗口下的窗口中的Servers标签栏鼠标左键双击tomcat服务器名,例如 Tomcat v7.0 Ser ...

  7. 七牛 在线管理 v0.1

    <?php // @codingStandardsIgnoreFile require_once __DIR__.'/../vendor/autoload.php'; use Qiniu\Aut ...

  8. weblogic一些基本概念

    <收藏过来的----------http://www.cnblogs.com/cocowool/archive/2012/04/01/2428861.html> WebLogic中的一些基 ...

  9. IE/Chrome背景图片居中1px偏移解决方法

    最近在支持行业运营的一个推广页面,遇到了非常规的页面banner图居中的问题,为了解决此问题,做了简单的测试,做了一个小结,为经常做大促页面的兄弟姐妹们提供参考解决方案. 首先来看看现象.最经典的页面 ...

  10. linux之ls -l|grep "^-"|wc -l命令

    查看某文件夹下文件的个数 ls -l |grep "^-"|wc -l 或 find ./company -type f | wc -l 查看某文件夹下文件的个数,包括子文件夹里的 ...