题意:根据题目,给定一些数字,让你判断是上升还是下降。

析:注意只有0,15时特别注意一下,然后就是14 15 1 0注意一下就可以了。

代码如下:

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
#include <cctype>
#include <cmath>
#include <stack>
#include <tr1/unordered_map>
#define freopenr freopen("in.txt", "r", stdin)
#define freopenw freopen("out.txt", "w", stdout)
using namespace std;
using namespace std :: tr1; typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f;
const LL LNF = 0x3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 1e3 + 5;
const int mod = 1e9 + 7;
const int N = 1e6 + 5;
const int dr[] = {-1, 0, 1, 0, 1, 1, -1, -1};
const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1};
const char *Hex[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
inline LL gcd(LL a, LL b){ return b == 0 ? a : gcd(b, a%b); }
int n, m;
const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
inline int Min(int a, int b){ return a < b ? a : b; }
inline int Max(int a, int b){ return a > b ? a : b; }
inline LL Min(LL a, LL b){ return a < b ? a : b; }
inline LL Max(LL a, LL b){ return a > b ? a : b; }
inline bool is_in(int r, int c){
return r >= 0 && r < n && c >= 0 && c < m;
}
int a[100]; int main(){
while(scanf("%d", &n) == 1){
for(int i = 0; i < n; ++i) scanf("%d", a+i);
if(n == 1 && a[0] != 15 && a[0] != 0){ printf("-1\n"); continue; }
else if(n == 1 && a[0] == 15){ printf("DOWN\n"); continue; }
else if(n == 1 && a[0] == 0){ printf("UP\n"); continue; }
if(a[n-1] == 15 && a[n-2] == 14) printf("DOWN\n");
else if(a[n-1] == 0 && a[n-2] == 1) printf("UP\n");
else if(a[n-1] > a[n-2]) printf("UP\n");
else printf("DOWN\n"); }
return 0;
}

CodeForces 719A Vitya in the Countryside (水题)的更多相关文章

  1. CodeForces 719A Vitya in the Countryside 思维题

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

  2. 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 ...

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

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

  4. CodeForces 719A. Vitya in the Countryside

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

  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. Educational Codeforces Round 7 B. The Time 水题

    B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...

  7. Educational Codeforces Round 7 A. Infinite Sequence 水题

    A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the ...

  8. Codeforces Testing Round #12 A. Divisibility 水题

    A. Divisibility Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/597/probl ...

  9. Codeforces Beta Round #37 A. Towers 水题

    A. Towers 题目连接: http://www.codeforces.com/contest/37/problem/A Description Little Vasya has received ...

随机推荐

  1. C/C++中static关键字作用总结 && 指针与引用的比较

    static作用: 常规答案: 1. 全局变量的隐藏:2. 函数体内记忆功能:3.类所有实例共享,static函数不接受this指针,只能访问static成员变量. 拓展:1.全局变量的隐藏,因为在其 ...

  2. fatal error C1189: #error : core.hpp header must be compiled as C++

    两次opencv工程需要设置为C++编译:找了一半天的解决方法. I am building a C application that uses OpenCV. when compiling, I g ...

  3. [转] 一句shell命令搞定代码行数统计

    今天面试时,突然被面试官问到怎样用shell命令搞定某个文件夹下java代码行数的统计. 想了一下,基本思路就是找到这个文件夹下面的所有java文件,然后每个文件统计一下代码,外层套个for循环,叠加 ...

  4. 【转】利用shell命令操作Memcached

    原文: 张宴的博客 —— http://zyan.cc/post/384/ -------------------------------------------------------------- ...

  5. javaproject积累——树形结构的操作

    近期一直被树形结构整的非常头大,又是递归.又是循环.可是,好在我们在经历了千辛万苦后.最终弄出来了.事实上就是组织机构的常规操作,有些是我们过度设计.有些是我们想错了.而对数的逻辑读取,我们就属于想错 ...

  6. Intel Edision —— 上电、基本设置与系统初探

    前言 原创文章,转载引用务必注明链接.如有疏漏,欢迎斧正. Intel的文档其实挺清楚了,坛子上很多人把文档又详细复述一边,私以为一篇就够了其他的跟着文档走一遍也挺好的...俗一把使用过程顺手记录下来 ...

  7. 一句话说清楚啥是delegate

    所谓托付就是类对象调用.托付对象代表随意实现该托付的类的对象.

  8. Photoshop 更改图片颜色

    程序猿兼职美术的常常没有时间搞太多图片.我们能够一张图片更改主要颜色来到达目的.我知道的主要有2种方法,1是更改色相,2是替换颜色.直接用油漆桶仅仅能在异常简单的图片才干用. 1. 更改色相      ...

  9. Intel Naming Strategy--1

    http://en.wikipedia.org/wiki/Mobile_Internet_device Computer sizes   Classes of computers   Larger S ...

  10. Nova虚拟机启动提示libvirtError

    OpenStack自动化安装基本折腾完毕,装一次大概也就10分钟,但是装完后今天我的虚拟机起不来,经过查找log发 现如下图提示: 已经到这里,说明已经过了nova-sheduler那一关,跟踪一下代 ...