水题 HDOJ 4727 The Number Off of FFF
/*
水题:判断前后的差值是否为1,b[i]记录差值,若没有找到,则是第一个出错
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
using namespace std; const int MAXN = 1e5 + ;
const int INF = 0x3f3f3f3f;
int a[MAXN];
int b[MAXN]; int main(void) //HDOJ 4727 The Number Off of FFF
{
//freopen ("L.in", "r", stdin); int t, cas = ;
int n;
scanf ("%d", &t);
while (t--)
{
scanf ("%d", &n); a[] = b[] = ;
for (int i=; i<=n; ++i)
{
scanf ("%d", &a[i]);
b[i] = a[i] - a[i-];
} int ans = -;
for (int i=; i<=n; ++i)
{
if (b[i] != )
{
ans = i; break;
}
}
if (ans == -) ans = ; printf ("Case #%d: %d\n", ++cas, ans);
} return ;
} /*
Case #1: 3
Case #2: 3
*/
水题 HDOJ 4727 The Number Off of FFF的更多相关文章
- HDU 4727 The Number Off of FFF (水题)
The Number Off of FFF Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
- 水题 HDOJ 4716 A Computer Graphics Problem
题目传送门 /* 水题:看见x是十的倍数就简单了 */ #include <cstdio> #include <iostream> #include <algorithm ...
- HDU 4727 The Number Off of FFF
The Number Off of FFF Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- HDU 4727 The Number Off of FFF 2013年四川省赛题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4727 题目大意:队列里所有人进行报数,要找出报错的那个人 思路:,只要找出序列中与钱一个人的数字差不是 ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- hdu 1005:Number Sequence(水题)
Number Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- hdu 1018:Big Number(水题)
Big Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- HDU-4727 The Number Off of FFF 水题
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4727 水题.. //STATUS:C++_AC_187MS_288KB #include <fu ...
- HDOJ/HDU 1328 IBM Minus One(水题一个,试试手)
Problem Description You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or ...
随机推荐
- Commando War
Commando War“Waiting for orders we held in the wood, word from the front never cameBy evening the so ...
- facedetect
继续学习大神的博文http://www.cnblogs.com/tornadomeet/archive/2012/03/22/2411318.html
- nginx(五)nginx与php的安装配置
经过前面学习,对nginx有个大概的了解,来配置LNMP;只要是在系统安装过程中选择安装比较齐全的包,基本上系统都能满足安装要求,下面是我一个一个测试的,基本上全部安装所需的库文件,放心安装: [ro ...
- CH round #55 Streaming #6
T^T Saffah大神照样刷我这样诚心诚意想做一套NOIP模拟题的蒟蒻. 第一题 九九归一 好diao的名字... 题意就是给定一队$n,q$,求在模$n$意义下一个数$x$自乘的循环节长度. 当$ ...
- android获取手机信息大全
IMEI号,IESI号,手机型号: private void getInfo() { TelephonyManager mTm = (TelephonyManager) getSystemServic ...
- 关于ubuntu配置静态IP 无法正常上网的解决方案
在ubuntu中配置静态IP后无法正常上网. 解决: 1.在终端执行 vim /etc/network/interfaces 在文件中加入如下内容,网关要写上,我开始一直无法上网就是因为没有配置网关 ...
- /lib /usr/lib /usr/local/lib区别
昨天问我/usr/lib 和/usr/local/lib 我仅记得一个是系统的,一个是用户的,于是今天查了查,有两篇文章介绍的不错,usr 很多人都认为是user缩写,其实不然,是unix syste ...
- spring中注解的通俗解释
我们在没有用注解写spring配置文件的时候,会在spring配置文件中定义Dao层的bean,这样我们在service层中,写setDao方法,就可以直接通过接口调用Dao层,用了注解写法后,在配置 ...
- 初识lua
转自:http://www.oschina.net/question/12_115993-- 两个横线是单行注释(译者注:这跟 SQL 一样) --[[ 增加两个 [ 和 ] 变成多行注释 我是多行注 ...
- 修改Tomcat服务器的默认端口号
tomcat服务器的默认端口号是8080,我们也可以修改为其他端口号,并且在没有启动Apache,IIS等占用80端口的web服务时,我们也可以设置为80端口,这样在生产中域名之后就可以不带端口号了, ...