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

  Every summer Vitya comes to visit his grandmother in the countryside. This summer, he got a huge wart. Every grandma knows that one should treat warts when the moon goes down. Thus, Vitya has to catch the moment when the moon is down.

  Moon cycle lasts 30 days. The size of the visible part of the moon (in Vitya's units) for each day is 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, and then cycle repeats, thus after the second 1 again goes 0.

  As there is no internet in the countryside, Vitya has been watching the moon for n consecutive days and for each of these days he wrote down the size of the visible part of the moon. Help him find out whether the moon will be up or down next day, or this cannot be determined by the data he has.

Input

  The first line of the input contains a single integer n (1 ≤ n ≤ 92) — the number of consecutive days Vitya was watching the size of the visible part of the moon.

  The second line contains n integers ai (0 ≤ ai ≤ 15) — Vitya's records.

  It's guaranteed that the input data is consistent.

Output

  If Vitya can be sure that the size of visible part of the moon on day n + 1 will be less than the size of the visible part on day n, then print "DOWN" at the only line of the output. If he might be sure that the size of the visible part will increase, then print "UP". If it's impossible to determine what exactly will happen with the moon, print -1.

Examples
Input
5

3 4 5 6 7
Output
UP
Input
7

12 13 14 15 14 13 12
Output
DOWN
Input
1

8
Output
-1
Note

  In the first sample, the size of the moon on the next day will be equal to 8, thus the answer is "UP".

  In the second sample, the size of the moon on the next day will be 11, thus the answer is "DOWN".

  In the third sample, there is no way to determine whether the size of the moon on the next day will be 7 or 9, thus the answer is -1.

解法:

 #include<stdio.h>
int main(){
int n,i;
int a[];
while(scanf("%d",&n)){
for(i=;i<n;i++)
scanf("%d",&a[i]);
if(n==&&a[n-]!=&&a[n-]!=)
printf("-1\n");
else if(a[n-]==) printf("DOWN\n");
else if(a[n-]==) printf("UP\n");
else if(a[n-]<&&a[n-]<a[n-])
printf("UP\n");
else if(a[n-]<&&a[n-]>a[n-])
printf("DOWN\n");
}
return ;
}

Codeforces 719A 月亮的更多相关文章

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

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

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

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

  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 719A:Vitya in the Countryside

    Description Every summer Vitya comes to visit his grandmother in the countryside. This summer, he go ...

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

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

  6. 【32.89%】【codeforces 719A】Vitya in the Countryside

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  7. Codeforces水题集合[14/未完待续]

    Codeforces Round #371 (Div. 2) A. Meeting of Old Friends |B. Filya and Homework A. Meeting of Old Fr ...

  8. Codeforces Round #373 (Div. 2)A B

    Codeforces Round #373 (Div. 2) A. Vitya in the Countryside 这回做的好差啊,a想不到被hack的数据,b又没有想到正确的思维 = = [题目链 ...

  9. Codeforces 989 P循环节01构造 ABCD连通块构造 思维对云遮月参考系坐标轴转换

    A 直接判存不存在连续的三个包含A,B,C就行 /*Huyyt*/ #include<bits/stdc++.h> #define mem(a,b) memset(a,b,sizeof(a ...

随机推荐

  1. JWT认证原理及使用

    一.JWT原理: 参考文章:https://www.jianshu.com/p/180a870a308a 1.传统的登录方式: 浏览器输入用户名密码,服务端校验通过,根据用户信息生成一个token,将 ...

  2. oracle表空间不足,ORA-00604的解决方法

    参考文章: http://blog.chinaunix.net/uid-26446098-id-3344813.html 错误信息如下: 从错误的角度可以推出:应该是表空间不足 根据查看表空间的使用情 ...

  3. Jenkins- job之间传参

    前言: 本文介绍插件: Parameterized Trigger plugin的具体使用方法. 一.插件介绍 Parameterized Trigger plugin插件可以让你在构建完成时触发新的 ...

  4. require('./expample.js).default详解

    最近总碰到类似于 var a = require('./expample.js).default 这样的代码,感觉很奇葩,总结一波. 为什么会出现这个问题? import 是静态编译的,而 requi ...

  5. 2198: 小P当志愿者送餐

    题目描述 在ICPC程序设计大赛期间,小P作为志愿者的任务是给各个学校送盒饭,小P一次最多可以携带M份盒饭.总共有N个学校来参加比赛,这N个学校的休息点在一条笔直的马路边一字排开,路的一头是小P取盒饭 ...

  6. C++入门之初话多态与虚函数

    多态性是面向对象程序设计的又一个重要思想,关于多态的详尽描述,请看本人的收藏https://www.cnblogs.com/hust-ghtao/p/3512461.html.这篇博文中,详尽的探讨了 ...

  7. mybatis配置文件配错

    UG] 2017-10-04 20:04:30,582(137226) --> [http-bio-8082-exec-9] org.springframework.web.servlet.ha ...

  8. echarts x轴 增加滚动条

    charts x轴 增加滚动条 在option 配置项中添加 [ dataZoom 中配置 ] 设置x轴滚动条 效果图: 动态拖动 以下参考代码 dataZoom配置 官网写法 option = { ...

  9. stark组件之展示数据(查)

      1.编辑按钮构建完成 2.构造表头,删除,checkbox,links编辑 3.代码+总结   1.编辑按钮构建完成 1.必备知识预习 第一个会打印5. 第二个输出alex alex是person ...

  10. docker技术之安装

    由于工作原因需要使用docker完成集群的搭建,特此记录一下研究的docker技术. 首先简单的介绍一下docker: Docker 使用 Google 公司推出的 Go 语言 进行开发实现,基于 L ...