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 ...
随机推荐
- html5 播放多个视频。一个接一个的播放
new个video,指定播放列表的第一个视频路径为src.监听end事件,回调里面把video的src改成列表的下一个,再play. 示意代码:var vList = ['视频地址url1', 'ur ...
- ASP.net mvc Code First 更新数据库
code first 数据库迁移步骤如下: 第一步:Add-Migration DataBase_Init 1. Install-Package EntityFramework.zh-Hans –Ve ...
- bzoj4305: 数列的GCD
要求k个与原序列中的数不同,就是要求(n-k)个相同,令K=n-k 然后cnt[i]表示序列a中i的倍数的个数 f[i]表示gcd为i的倍数的方案数 f[i]=C(cnt[i],K)*(m/i-1)^ ...
- WebClient 使用
--post 请求 public static string PostMsg(Guid orgid, int page, int rows) { System.N ...
- [bzoj1911][Apio2010]特别行动队
Description 有个元素,可以将个元素分成多组,每组的元素编号必须是连续的. 设每组的为,则每组的价值公式为. 求最大价值和. Input 输入由三行组成. 第一行包含一个整数,表示士兵的总数 ...
- FAILED java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI:hdfs:192.*
运行的参数配置 hdfs:192.168.58.180/cf/userItem.txt 应该写成 hdfs://192.*
- VS中的代码段功能
1.前言 开发人员不喜欢打字.如果你希望提高开发人员的生产力,减少键入的数量,这也同时减少打字稿的数量以及因此产生的编译器错误,这些都极大分散了开发人员的注意力.代码重用是开发人员收集代码的另一个原因 ...
- Linux System Account SSH Weak Password Detection Automatic By System API
catalog . Linux弱口令攻击向量 . Linux登录验证步骤 . PAM . 弱口令风险基线检查 1. Linux弱口令攻击向量 0x1: SSH密码暴力破解 hydra -l root ...
- iOS Swift最简单的Animation
最近发现Animation是一个iOS开发中非常好玩的元素,能给应用的交互性增色不少.比如很多音乐应用的菜单从底部弹出和隐藏的效果. Animation最核心的当然就是UIView的animateWi ...
- [iOS Xcode注释插件]
来自onevcat的VVDocumenter-Xcode,地址是:https://github.com/onevcat/VVDocumenter-Xcode 使用方式:按三下"/" ...