codeforces 719A Vitya in the Countryside(序列判断趋势)
题目链接:http://codeforces.com/problemset/problem/719/A
题目大意:
题目给出了一个序列趋势 0 、1 、2 、3 ---14 、15 、14 ----3 、 2 、1 、0、1---
输入 整数 n ,第二行输入 n(1<=n<=92) 个数,判断下个数 是大于最后一个数还是小于最后一个,大于输出 UP,小于输出 DOWN,如果没法判断 输出 -1.
解题思路:
找转折点即可。
特判 n==1.
剩下的代码解释。
AC Code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
int day,day1;
if(n==)
{
scanf("%d",&day);
if(day==)printf("UP\n");
else if(day==)printf("DOWN\n");
else printf("-1\n");
}
else
{
for(int i=; i<n-; i++)
scanf("%d",&day);
scanf("%d",&day1);
if(day<day1 && day1!= || day1==)printf("UP\n");
else printf("DOWN\n");
}
}
return ;
}
codeforces 719A Vitya in the Countryside(序列判断趋势)的更多相关文章
- CodeForces 719A. Vitya in the Countryside
链接:[http://codeforces.com/group/1EzrFFyOc0/contest/719/problem/A] 题意: 给你一个数列(0, 1, 2, 3, 4, 5, 6, 7, ...
- CodeForces 719A Vitya in the Countryside (水题)
题意:根据题目,给定一些数字,让你判断是上升还是下降. 析:注意只有0,15时特别注意一下,然后就是14 15 1 0注意一下就可以了. 代码如下: #pragma comment(linker, & ...
- CodeForces 719A Vitya in the Countryside 思维题
题目大意:月亮从0到15,15下面是0.循环往复.给出n个数字,如果下一个数字大于第n个数字输出UP,小于输出DOWN,无法确定输出-1. 题目思路:给出0则一定是UP,给出15一定是DOWN,给出其 ...
- 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 ...
- 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 ...
- Codeforces 719A 月亮
参考自:https://www.cnblogs.com/ECJTUACM-873284962/p/6395221.html A. Vitya in the Countryside time limit ...
- A. Vitya in the Countryside
A. Vitya in the Countryside time limit per test 1 second memory limit per test 256 megabytes input s ...
- codeforces 719A:Vitya in the Countryside
Description Every summer Vitya comes to visit his grandmother in the countryside. This summer, he go ...
- 【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 ...
随机推荐
- linux 配置 crontab
linux中的crontab是定时用的,下面的cron服务就是定时器的意思 crontab -l 列举所有的cron服务 crontab -e 修改cron服务 crontab -r 删除cron服务 ...
- MyBatis中的resultType和resultMap
MyBatis的查询在进行映射的时候,返回值类型可以使用resultType同时也可以使用resultMap.前者表示直接的返回值类型,一般是domain名称,当然这里可以写domain的全部路径也可 ...
- [转]《Hadoop基础教程》之初识Hadoop
原文地址:http://blessht.iteye.com/blog/2095675 Hadoop一直是我想学习的技术,正巧最近项目组要做电子商城,我就开始研究Hadoop,虽然最后鉴定Hadoop不 ...
- [转]java web简单权限管理设计
原文地址:http://blog.csdn.net/zwx19921215/article/details/44467099 最近在做一个网站类型项目,主要负责后台,ui框架选型为jquery eas ...
- 【HDU 5750】Dertouzos(数学)
题目给定n和d,都是10的9次方以内,求1到n里面有几个数最大因数是d?1000000组数据.解:求出d的满足p[i]*d<n的最小质因数是第几个质数.即为答案. #include<cst ...
- Xcode插件VVDocumenter Alcatraz KSImageNamed等安装
今天安装VVDocumenter,总是不起作用...所以用Alcatraz...下面介绍下Alcatraz 一.Alcatraz Alcatraz 是一款 Xcode的插件管理工具,可以用来管理XCo ...
- 【转】Handler学习笔记(一)
一.Handler的定义: Handler主要接收子线程发送的数据, 并用此数据配合主线程更新UI,用来跟UI主线程交互用.比如可以用handler发送一个message,然后在handler的线程中 ...
- python初识生成器 迭代器
生成器 带有 yield 的函数在 Python 中被称之为 generator(生成器) def xragns(): #定义函数生成器 print('小伙') yield ('好') #加上yiel ...
- VI,CI,UI
一.VI VI全称Visual Identity, 即企业VI视觉设计,通译为视觉识别系统.是将CI的非可视内容转化为静态的视觉识别符号.设计到位.实施科学的视觉识别系统,是传播企业经营理念.建立企业 ...
- JAVA实现打印机
我这里有以前收藏的代码,两个类实现了简易的文本打印机的功能,包括预览.简单跟你说一下. 1.PrinterDemo.java主体类,也是入口类,里面有main方法可以直接在Eclipse中调试运行,他 ...