CodeForces 719A Vitya in the Countryside 思维题
题目大意:月亮从0到15,15下面是0、循环往复。给出n个数字,如果下一个数字大于第n个数字输出UP,小于输出DOWN,无法确定输出-1.
题目思路:给出0则一定是UP,给出15一定是DOWN,给出其他的一个数字(n==1)无法确定,其他的情况比较后两位。
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#include<stdio.h>
#include<stdlib.h>
#include<queue>
#include<math.h>
#include<map>
#define INF 0x3f3f3f3f
#define MAX 1000005
#define Temp 1000000000 using namespace std; int a[MAX];
int main()
{
int n,op;
while(scanf("%d",&n)!=EOF)
{
for(int i=;i<=n;i++)
scanf("%d",&a[i]);
if(n==)
{
if(a[n]==)
op=-;
else if(a[n]==)
op=;
else
op=;
}
else
{
if(a[n]==)
op=-;
else if(a[n]==)
op=;
else if(a[n] > a[n-])
op=;
else if(a[n] < a[n-])
op=-;
}
if(op==)
printf("-1\n");
else if(op==)
printf("UP\n");
else
printf("DOWN\n");
}
return ;
}
CodeForces 719A Vitya in the Countryside 思维题的更多相关文章
- CodeForces 719A Vitya in the Countryside (水题)
题意:根据题目,给定一些数字,让你判断是上升还是下降. 析:注意只有0,15时特别注意一下,然后就是14 15 1 0注意一下就可以了. 代码如下: #pragma comment(linker, & ...
- codeforces 719A Vitya in the Countryside(序列判断趋势)
题目链接:http://codeforces.com/problemset/problem/719/A 题目大意: 题目给出了一个序列趋势 0 .1 .2 .3 ---14 .15 .14 ----3 ...
- CodeForces 719A. Vitya in the Countryside
链接:[http://codeforces.com/group/1EzrFFyOc0/contest/719/problem/A] 题意: 给你一个数列(0, 1, 2, 3, 4, 5, 6, 7, ...
- 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 ...
- 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 718E - Matvey's Birthday(思维题)
Codeforces 题面传送门 & 洛谷题面传送门 首先注意到这个图的特殊性:我们对于所有 \(s_i=s_j\) 的 \((i,j)\) 之间都连了条边,而字符集大小顶多只有 \(8\ ...
- Codeforces 643F - Bears and Juice(思维题)
Codeforces 题目传送门 & 洛谷题目传送门 首先直接暴力枚举显然是不现实的,我们不妨换个角度来处理这个问题,考虑这 \(R_i\) 个瓶子中每一瓶被哪些熊在哪一天喝过. 我们考虑对这 ...
- Codeforces 627E - Orchestra(双向链表,思维题)
Codeforces 题目传送门 & 洛谷题目传送门 下设 \(n,m\) 同阶. 首先有一个傻子都会的暴力做法,枚举矩形的上.下边界 \(l,r\),考虑集合多重集 \(S=\{y|x\in ...
- Codeforces Round #416 (Div. 2)(A,思维题,暴力,B,思维题,暴力)
A. Vladik and Courtesy time limit per test:2 seconds memory limit per test:256 megabytes input:stand ...
随机推荐
- 背包类问题解答——poj3624分析
习题网址:http://poj.org/problem?id=3624 试题分析:该类题通过限定物品总数量.总质量:并且初始化每个物品的起始质量和一个量化的性质.最后求解最值的量化性质的值是多少的问题 ...
- luci-bwc(记录流量功能)
使用方法如下: root@openwrt:/# luci-bwcUsage: luci-bwc [-t timeout] -i ifname // ifname为 ...
- Linux(power服务器)中kettle(2)
Hadoop集群硬件环境 4台机器 ip地址 172.16.1.131 172.16.1.132 172.16.1.133 172.16.1.134 每台内存16G 8核cpu 直接使用报错:
- Delphi用ADOquery主从表例子(转)
http://blog.csdn.net/kandy_zheng/article/details/1639184 在sql server 的northwide 中建立主表 create table s ...
- Myeclipse 激活代码 8.6以前的版本
public class Akey { private static final String LL = "Decompiling this copyrighted software is ...
- SQL Server 把当前日期中月份和几号中的0 去掉
select left(convert(varchar(10),getdate(),20),4)+replace(right(convert(varchar(10),getdate(),20),6), ...
- SharePoint2013基于Form(FBA)的AD认证登陆
来源于:http://www.haogongju.net/art/1964313 1. 使用SharePoint2013实现基于AD的Form认证,首先创建一个Web Application,步骤如下 ...
- C语言语法tips(不断更新)
语法虽然琐碎,犯了低级错误代价可就大了,列出一些容易混淆概念,避免以后出错 sizeof和strlen的区别在于:1.sizeof是运算符,语言支持的,strlen可以求malloc出来的字符串的长度 ...
- 自定义控件之--继承控件(圆形TextView)
师从郭大,自学于心,继承控件无疑就是继承自现有控件,保持继承的控件的属性并进行必要的扩展. 比如下面这个自定义控件,它就保持了TextView的属性,并对TextView的外观进行必要的修改该来适 ...
- centos下安装与配置Apache方法
下面以httpd-2.0.55.tar.gz版本为例,介绍Apache在Linux中的安装过程:1.解压和解包安装文件:gzip -d httpd-2.0.55.tar.gztar xvf httpd ...