The Number Off of FFF

hdu4727:http://acm.hdu.edu.cn/showproblem.php?pid=4727

题意:给你一个序列,每个数比前面一个数大一。如果不是大一,则输出这个位子,如果都是大一,则输出1.

题解:水题。

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<algorithm>
 4 #include<cstring>
 5 using namespace std;
 6 int n,temp,x,a[100003];
 7 int main(){
 8    int T,tt=1;
 9    scanf("%d",&T);
10    while(T--){
11         scanf("%d",&n);
12         for(int i=1;i<=n;i++)
13           scanf("%d",&a[i]);
14           int i;
15         for( i=1;i<n;i++){
16             if(a[i+1]-a[i]!=1)
17                 break;
18         }
19         if(i==n)printf("Case #%d: 1\n",tt++);
20         else
21             printf("Case #%d: %d\n",tt++,i+1);
22    }
23 }

时间: 2024-12-14 18:42:51

The Number Off of FFF的相关文章

水题 HDOJ 4727 The Number Off of FFF

题目传送门 1 /* 2 水题:判断前后的差值是否为1,b[i]记录差值,若没有找到,则是第一个出错 3 */ 4 #include <cstdio> 5 #include <iostream> 6 #include <algorithm> 7 #include <cstring> 8 #include <string> 9 #include <cmath> 10 using namespace std; 11 12 const in

jquery.cycle.js简单用法实例

样式: a{text-decoration: none;} *{margin:0; padding:0;} /*容器设置*/ .player { width:216px; height:248px; background:url(http://i2.itc.cn/20120117/2cc0_da8f6c82_c8da_693d_7714_9533a013006a_3.jpg) no-repeat; background-color:#ede1d1; position:relative; padd

2013 成都邀请赛

今年又要打邀请赛了,前段时间做比赛都被虐的够呛.感觉不会再爱了...所以挂了下去年的成都邀请赛的题目.发现简单题还是能切上几道的,可是难题就无能为力了.. .阿门,还是水平差得远啊.. . (ps:近期感觉状态不佳.依靠了队友神勇的发挥. .. Current Time: 2014-05-15 08:43:24 Contest Type: Public Start Time: 2014-05-14 15:10:00 Contest Status: Ended End Time: 2014-05-

select for update引发死锁分析

本文针对MySQL中在Repeatable Read的隔离级别下使用select for update可能引发的死锁问题进行分析. 1. 案例 业务中需要对各种类型的实体进行编号,例如对于x类实体的编号可能是x201712120001,x201712120002,x201712120003类似于这样.可以观察到这类编号有两个部分组成:x+日期作为前缀,以及流水号(这里是四位的流水号). 如果用数据库表实现一个能够分配流水号的需求,无外乎就可以建立一个类似于下面的表 CREATE TABLE nu

HDU4719-Oh My Holy FFF(DP线段树优化)

Oh My Holy FFF Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others) Total Submission(s): 606    Accepted Submission(s): 141 Problem Description N soldiers from the famous "*FFF* army" is standing in a line, from le

hdu4719——Oh My Holy FFF

Oh My Holy FFF Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others) Total Submission(s): 626    Accepted Submission(s): 147 Problem Description N soldiers from the famous "*FFF* army" is standing in a line, from le

hdu 4719 Oh My Holy FFF(dp线段树优化)

Oh My Holy FFF Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others) Total Submission(s): 848    Accepted Submission(s): 219 Problem Description N soldiers from the famous "*FFF* army" is standing in a line, from le

2017 Multi-University Training Contest - Team 9 1005&amp;&amp;HDU 6165 FFF at Valentine【强联通缩点+拓扑排序】

FFF at Valentine Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1060    Accepted Submission(s): 506 Problem Description At Valentine's eve, Shylock and Lucar were enjoying their time as any oth

hdu4719 Oh My Holy FFF[线段树优化dp]

Oh My Holy FFF Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 1047    Accepted Submission(s): 291 Problem Description N soldiers from the famous "*FFF* army" is standing in a line, from le