题目大意:月亮从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. AVFoundation--AVPlayer

    // // AVPlayerNetViewController.m // PodsTest // // Created by ZhuYi on 16/4/29. // Copyright © 2016 ...

  2. [SOJ] 1282. Computer games (KMP)

    坑爹题 1282. Computer Game Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description Brian is an ...

  3. FBO

    #include <GL/glew.h> #include <GL/freeglut.h> #include <iostream> #pragma comment( ...

  4. json 和 数组的区别

    json是javascript中的一种数据格式,类似于数组,但又不同于数组,区别在于下标: 例如,var obj=[a:15,b:10,c:3,d:8]: //这是json的写法 var  arr=[ ...

  5. 【转】Spring事务超时时间可能存在的错误认识

    1.先看代码 1.1.spring-config.xml <bean id="dataSource" class="org.springframework.jdbc ...

  6. [ An Ac a Day ^_^ ] hdu 1662 Trees on the level 数据结构 二叉树

    紫书上的原题 正好学数据结构拿出来做一下 不知道为什么bfs的队列一定要数组模拟…… 还可以练习一下sscanf…… #include<stdio.h> #include<iostr ...

  7. Mainline/Stable/Legacy

    Nginx官网提供了三个类型的版本Mainline version:Mainline 是 Nginx 目前主力在做的版本,可以说是开发版Stable version:最新稳定版,生产环境上建议使用的版 ...

  8. ural 1698. Square Country 5(记忆化搜索)

    1698. Square Country 5 Time limit: 2.0 secondMemory limit: 64 MB The first arithmetical operation ta ...

  9. C#第九天

    1.绝对路径和相对路径绝对路径:通过给定的这个路径直接能在我的电脑中找到这个文件. 相对路径:文件相对于应用程序的路径. 结论:我们在开发中应该去尽量的使用相对路径. 2.装箱.拆箱 装箱:就是将值类 ...

  10. Time complexity of ArrayList in Java

    The size, isEmpty, get, set, iterator, and listIterator operations run in constant time. The add ope ...