水题 HDOJ 4727 The Number Off of FFF

时间:2023-03-09 17:54:36
水题 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
*/