题目传送门

 /*
水题:判断前后的差值是否为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
*/

最新文章

  1. css文件 引用后不起作用
  2. webform:分页组合查询
  3. servletconfig和servletContext的区别
  4. 修改windows系統下xampp中apache端口被其他程式占用的問題
  5. 微信内测&quot;微视频&quot; 朋友圈可以发6-8秒短视频
  6. hdu 5150 Sum Sum Sum 水
  7. linux 基本命令 [转]
  8. ClassLoader源码
  9. Test Controller Tool
  10. useradd、passwd、userdel
  11. HDOJ 1330 Deck(叠木块-物理题啊!贪心算法用到了一点)
  12. 微信小程序选项卡功能
  13. WindowsAll下安装与破解IntelliJ IDEA2017
  14. 基于.NET的弹性及瞬间错误处理库Polly
  15. Windows提示 错误: RPC 服务器不可用 解决方法。
  16. MyBatis-day1
  17. Qt的子窗口和父窗口阻塞问题
  18. linux存储管理之文件系统
  19. linux虚拟机设置本地yum源
  20. gcc,g++

热门文章

  1. xcode注释
  2. Ubuntu上安装gtk2.0不能安装的问题,“下列的软件包有不能满足的依赖关系”
  3. 用VMware安装虚拟系统时出现Invalid system disk,Replace the disk and then press any key
  4. MVC 修饰标签
  5. selenium启动Chrome时,加载用户配置文件
  6. 28. 字符串的全排列之第2篇[string permutation with repeating chars]
  7. delphi 换行操作 Word
  8. php5.4.3连接SQLite3
  9. Android开发之onClick事件的三种写法
  10. JavaScript数组常用操作