题目链接: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(序列判断趋势)的更多相关文章

  1. CodeForces 719A. Vitya in the Countryside

    链接:[http://codeforces.com/group/1EzrFFyOc0/contest/719/problem/A] 题意: 给你一个数列(0, 1, 2, 3, 4, 5, 6, 7, ...

  2. CodeForces 719A Vitya in the Countryside (水题)

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

  3. CodeForces 719A Vitya in the Countryside 思维题

    题目大意:月亮从0到15,15下面是0.循环往复.给出n个数字,如果下一个数字大于第n个数字输出UP,小于输出DOWN,无法确定输出-1. 题目思路:给出0则一定是UP,给出15一定是DOWN,给出其 ...

  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. linux 配置 crontab

    linux中的crontab是定时用的,下面的cron服务就是定时器的意思 crontab -l 列举所有的cron服务 crontab -e 修改cron服务 crontab -r 删除cron服务 ...

  2. SwipeRefreshLayout 首次打开出现加载图标

    最近要实现如何如图效果: 主要是在初始化,代码如下: , getResources().getDimensionPixelSize(typed_value.resourceId));    refre ...

  3. 显示当前用户所拥有的表&当前用户可以访问的所有表&数据库中的所有表&当前用户信息&当前用户所能管理的用户&数据库中所拥有的用户

    1)显示当前用户名称:show user或者show user; 2)显示当前用户信息(包括用户名之外还有其他信息):select * from user_users; 3)显示数据库中所含有的所有用 ...

  4. bitmap转化base64

    /** * bitmap转化base64 */public static String bitmapToBase64(Bitmap bitmap) { String result = null; By ...

  5. easyui-datagrid 的loader属性用法

    API介绍比较简略: 定义如何从远程服务器加载数据.返回false可以放弃本次请求动作.该函数接受以下参数:param:参数对象传递给远程服务器.success(data):当检索数据成功的时候会调用 ...

  6. ( 转 ) Android自绘字体大小paint.settextsize随分辨率大小变化

    1.获取当前设备的屏幕大小 DisplayMetrics displayMetrics = new DisplayMetrics(); this.getWindowManager().getDefau ...

  7. 日期处理-将String 转为Date

    package com.test; import java.text.DateFormat; import java.text.ParseException; import java.text.Sim ...

  8. Cross-Entropy Loss 与Accuracy的数值关系

    以分类任务为例, 假设要将样本分为\(n\)个类别. 先考虑单个样本\((X, z)\). 将标题\(z\)转化为一个\(n\)维列向量\(y = (y_1, \dots y_k, \dots, y_ ...

  9. Eclipse自动调整格式

    Eclipse 编写Java代码的时候,使用右键Source -> Format 后,将自动调整格式,若想要{ 单独占一行,则可以自己定义相关格式模板 新建 CodeFormatter.xml ...

  10. CGCDSSQ

    这道题很妙啊.其实我们可以发现重要的不是起点和终点,重要的是个数,然后脑洞一下,可以递推.(我什么都没有想出来)假设我们已经知道了前面所有子串的gcd,那么我们可以用现在的a[i]和前面每个数求gcd ...