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 ...
随机推荐
- 使用js和jq去掉左右空格方法
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <script src ...
- tomcat 实例
现在举一个tomcat应用的例子: 我们现在安装一个jenkins, jenkins的安装方式有两种: 一种是war包的安装方式 另一种是:把下载的安装war包放在tomcat的webapps目录下 ...
- [转]Java使用commons-dbcp2.0
原文地址:http://blog.csdn.net/jiutianhe/article/details/39670817 dbcp 是 apache 上的一个 java 连接池项目,也是 tomcat ...
- Swift开发小技巧--private访问修饰符报错的情况
1.Swift中的访问修饰符(三个,作用:用来修饰属性,方法和类) public : 最大权限 -- 可以在当前framework和其他framework中访问 internal : 默认的权限 -- ...
- Dubbo系列(3)_官方Demo说明
一.本文目的 通过Dubbo的官方Demo介绍,学会搭建一个简单的Dubbo程序,包括服务端.客户端.接口等. Demo地址:https://github.com/alibaba/dubbo/ ...
- innerHTML和appendChild的性能
目测innerHTML比appendChild好了3到4倍, 但是界面渲染还是很慢啊: chrome结果 /** *chrome浏览器; * innerHTML appendChild * 1千条的 ...
- C#-WinForm-打印控件
打印控件 绘制如下窗体 一.PrintDocument -打印的基础 首先放置PrintDocument控件,双击事件PrintPage设置要打印的样式(李献策lxc) //第一步 设置打印属性 p ...
- mysql列转行
要得到 SELECT name, SUM(CASE course WHEN '语文' THEN score END ) AS '语文', SUM(CASE course WHEN '数学' THEN ...
- 1.python算法之汉诺塔
代码如下: #!/usr/bin/env python # encoding: utf-8 """ @author: 侠之大者kamil @file: 汉诺塔.py @t ...
- BZOJ 1089: [SCOI2003]严格n元树
1089: [SCOI2003]严格n元树 Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 1591 Solved: 795[Submit][Statu ...