题目大意:月亮从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. Jquery获得 selection的text 和 option值

    Jquery获得 selection的text 和 option值 <select id="accountStatus" editable="false" ...

  2. MATLAB制作符合IEEE标准的图插入Latex

    1.MATLAB最好保存为eps格式,虽然IEEE也支持png等其他格式,但是MATLAB在保存为png格式时,很容易在后期插图时,出现分辨率不足等问题. 2. MATLAB在save as图片的时候 ...

  3. ATL opengl

    #include <atlbase.h> #include <atlwin.h> #include <gl/glew.h> #include <gl/GL.h ...

  4. Excel教程(11) - 查找和引用函数

    ADDRESS 用途:以文字形式返回对工作簿中某一单元格的引用.    语法: sheADDRESS(row_num,column_num,abs_num,a1,et_text) 参数:Row_num ...

  5. css3的特效拓展...

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. subnetting and the subnet mask

    原文:https://www.techopedia.com/6/28587/internet/8-steps-to-understanding-ip-subnetting/5 Step 4 - Sub ...

  7. 《JavaScript高级程序设计》读书笔记 ---基本概念小结

     ECMAScript 中的基本数据类型包括Undefined.Null.Boolean.Number 和String. 与其他语言不同,ECMScript 没有为整数和浮点数值分别定义不同的数据 ...

  8. 感知哈希算法的java实现

    一.原理讲解      实现这种功能的关键技术叫做"感知哈希算法"(Perceptual Hash Algorithm), 意思是为图片生成一个指纹(字符串格式), 两张图片的指纹 ...

  9. chrome插件:打开新tab时自动打开百度

    下载 安装: 解压到某一目录 如要修改自动跳转链接:修改go.js中的url (function (){ chrome.tabs.getCurrent(function(tab){ chrome.ta ...

  10. VBS 读取文本文件特殊字符前如逗号的值并赋值给变量

    我使用的仿真终端SecureCRT需要使用一个脚本,支持VBS的.我需要实现如下功能: 首先文本文件在:D:\100.txt文本文件的内容为:9 0,randy,9 1,jeff,9 2,sameul ...