水题 HDOJ 4727 The Number Off of FFF
2024-10-13 19:19:20
/*
水题:判断前后的差值是否为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
*/
最新文章
- css文件 引用后不起作用
- webform:分页组合查询
- servletconfig和servletContext的区别
- 修改windows系統下xampp中apache端口被其他程式占用的問題
- 微信内测";微视频"; 朋友圈可以发6-8秒短视频
- hdu 5150 Sum Sum Sum 水
- linux 基本命令 [转]
- ClassLoader源码
- Test Controller Tool
- useradd、passwd、userdel
- HDOJ 1330 Deck(叠木块-物理题啊!贪心算法用到了一点)
- 微信小程序选项卡功能
- WindowsAll下安装与破解IntelliJ IDEA2017
- 基于.NET的弹性及瞬间错误处理库Polly
- Windows提示 错误: RPC 服务器不可用 解决方法。
- MyBatis-day1
- Qt的子窗口和父窗口阻塞问题
- linux存储管理之文件系统
- linux虚拟机设置本地yum源
- gcc,g++
热门文章
- xcode注释
- Ubuntu上安装gtk2.0不能安装的问题,“下列的软件包有不能满足的依赖关系”
- 用VMware安装虚拟系统时出现Invalid system disk,Replace the disk and then press any key
- MVC 修饰标签
- selenium启动Chrome时,加载用户配置文件
- 28. 字符串的全排列之第2篇[string permutation with repeating chars]
- delphi 换行操作 Word
- php5.4.3连接SQLite3
- Android开发之onClick事件的三种写法
- JavaScript数组常用操作