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 ...
随机推荐
- PS转手绘
2014-08-03 一.人物皮肤处理 复制两层图层,对背景图层隐藏,最后一层 高斯模糊 ,按住ALT创建图层蒙版, 使用画笔工具涂抹人物皮肤,眼睛不涂,把阴影和高光处抹均匀,最后应用图层蒙版,向下 ...
- Query DSL for elasticsearch Query
Query DSL Query DSL (资料来自: http://www.elasticsearch.cn/guide/reference/query-dsl/) http://elasticsea ...
- [转] 使用Spring MVC构建REST风格WEB应用
原文地址:http://fancy888.iteye.com/blog/1629120 对于运行在网络上的MIS系统而言,处理数据的是整个系统的主要任务,翻开程序我们可以看到,80%以上的代码都在处理 ...
- nodeJS+express+Jade写一个局域网聊天应用(node基础)
为了复习一下nodeJS, 而且socketIO这东西听起来就好高端有木有, 而且有人写过了open, 也可以作为自己的参考有木有, 点击下载源代码: express是4.x的版本, 跟以前的配置有些 ...
- Mysql-windows下修改密码
忘记密码修改(以下各种方法视情况而使用,本人测试,有些都是案情况才可行,但都是有设置成功过) 注:修改密码成功后一定要记得刷新下权限(否则将导致不能使用当前用户连接) mysql>FLUSH P ...
- 自定义View完全解析
自定义View主要包括以下3种方式: 一.组合控件,利用已有控件的组合,来满足自己的需求. 例子:顶部导航栏 二.继承已有View,比如继承TextView.ImageView等,根据需要重写相应的方 ...
- bzoj4409&&bzoj4410&&bzoj4411[Usaco2016 Feb Platinum]题解
辣鸡wyz最近状态奇差,于是想用usaco题找找手感,万万没想到被虐了一脸TAT 先贴代码,有空再填坑 4409[Usaco2016 Feb]Circular barn #include <io ...
- 【unity shaders】:Unity中的Shader及其基本框架
shader和Material的基本关系 Shader(着色器)实际上就是一小段程序,它负责将输入的Mesh(网格)以指定的方式和输入的贴图或者颜色等组合作用,然后输出.绘图单元可以依据这个输出来将图 ...
- Noip2016のmengbier
Day0 上午10点多上了火车,向三位学长问了一路去年noip他们是用什么心态去考的,明明老师和同学都说我正常发挥应该没什么问题但心里就是紧张的不行,就是害怕犯个sb错误爆上一道题TAT. 去试机.. ...
- choorme 升级到最新版 adobe flash提示过期解决方案
进入adobe flash 官网,下载最新版的adobe flash http://labs.adobe.com/downloads/flashplayer.html