链接:[http://codeforces.com/group/1EzrFFyOc0/contest/719/problem/A]

题意:

给你一个数列(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),然后重复循环这个数列,输入一个n,再输入有n个元素的某段,问你接下来是UP还是DOWN,若无法判断输出-1。

思路:

枚举各种情况,注意n1,a[n]15是DOWN。

代码:

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n,i,a[100];
cin>>n; for(i=1;i<=n;i++)
cin>>a[i]; if(n==1&&a[n]==0){
cout<<"UP\n";
}
else if(n==1&&a[n]==15){
cout<<"DOWN\n";
}
else if(n==1&&a[n]!=0)
{
cout<<-1<<endl;
}
else if(a[n-1]<a[n]&&a[n]!=15)
{
cout<<"UP\n";
}
else if(a[n-1]<a[n]&&a[n]==15){
cout<<"DOWN\n";
}
else if(a[n-1]>a[n]&&a[n]!=0){
cout<<"DOWN\n";
}
else if(a[n-1]>a[n]&&a[n]==0){
cout<<"UP\n";
}
return 0;
}

CodeForces 719A. Vitya in the Countryside的更多相关文章

  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 (水题)

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

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

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

  6. Codeforces 719A 月亮

    参考自:https://www.cnblogs.com/ECJTUACM-873284962/p/6395221.html A. Vitya in the Countryside time limit ...

  7. A. Vitya in the Countryside

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

  8. codeforces 719A:Vitya in the Countryside

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

  9. 【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 ...

随机推荐

  1. 洗礼灵魂,修炼python(71)--爬虫篇—【转载】xpath/lxml模块,爬虫精髓讲解

    Xpath,lxml模块用法 转载的原因和前面的一样,我写的没别人写的好,所以我也不浪费时间了,直接转载这位崔庆才大佬的 原帖链接:传送门 以下为转载内容: --------------------- ...

  2. oracle 压力测试工具benchmarksql

    TPC-C测试 TPC-C 于 1992 年 7 月 23 日认可为新的基准测试.TPC(Transaction Processing Performance Council,事务处理性能委员会)-C ...

  3. linux shell 指令 诸如-d, -f, -e之类的判断表达式简介

    一.文件比较运算符 1. e filename 如果 filename存在,则为真 如: [ -e /var/log/syslog ] 2. -d filename 如果 filename为目录,则为 ...

  4. Windows单机最大TCP连接数的问题

    本文和大家分享一下Windows下单机最大TCP连接数,因为在做Socket 编程时,我们经常会要问,单机最多可以建立多少个 TCP 连接,本文将介绍如何调整系统参数来调整单机的最大TCP连接数. W ...

  5. 【PAT】B1008 数组元素循环右移问题

    猥琐方法 直接分成两部分输出数组元素,注意空格的问题 #include<stdio.h> int arr[101]; void Priarr(int a,int b){ if(a<= ...

  6. JavaScript数据类型之数字类型

    引言 JavaScript不区分整数值和浮点数值,全部使用浮点数值表示.当一个数字直接出现在JavaScript程序中,我们称之为数字直接量(numeric litertal).JavaScript支 ...

  7. openPose-注

    静态编译出错:MD能通过 \ https://blog.csdn.net/Silver_sail/article/details/40540887 E:\project\BodyPoseEstimat ...

  8. 《Java大学教程》—第20章 文件处理

    记录():一个单独的数据实例.域():一个属性. 20.3    输入和输出设备:P484输入过程和输出过程.操作系统负责建立三个流(stream):标准输入流(System.in).标准输出流(Sy ...

  9. 寒假训练——搜索 K - Cycle

    A tournament is a directed graph without self-loops in which every pair of vertexes is connected by ...

  10. Linux的常见问题解答和管理技巧

    Linux的常见问题解答和管理技巧 一. 如何建立多用户 提醒大家一句,别一直使用root用户,因为root用户在系统中有着至高无上的权力,一不小心就可能破坏系统.比如我们想删除/temp目录下的文件 ...