题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5400

水题

 #include<stdio.h>
 typedef long long LL;
 const int MAXN = 1e5;
 LL cnt( int x ){
         )/;
 }
 int main(){
     int n;
     int d1, d2;
     int flag;
     int ct;
     long long ans;
     int a[MAXN];
     while(~scanf("%d %d %d",&n,&d1,&d2)){
         ; i < n; ++i){
             scanf("%d",&a[i]);
         }
         flag = ;
         ans = n;
         ct = ;
         ; i < n; ++i){
             ])== d1 ){
                 ){
                     flag = ;
                     ans += cnt(ct);
                     ct = ;
                 }
                 else
                     ct++;
             }
             ])==d2){
                 flag = ;
                 ct++;
             }
             else{
                 ans += cnt(ct);
                 ct = ;
             }
         }
         if(ct)
             ans += cnt(ct);
         printf("%I64d\n",ans);
     }
 }

hdoj 5400 Arithmetic Sequence的更多相关文章

  1. 构造 HDOJ 5400 Arithmetic Sequence

    题目传送门 题意:问有多少个区间,其中存在j使得ai + d1 == ai+1(i<j) && ai + d2 == ai+1 (i>j) 构造:用c1[i], c2[i] ...

  2. hdu 5400 Arithmetic Sequence

    http://acm.hdu.edu.cn/showproblem.php?pid=5400 Arithmetic Sequence Time Limit: 4000/2000 MS (Java/Ot ...

  3. hdu 5400 Arithmetic Sequence(模拟)

    Problem Description A sequence b1,b2,⋯,bn are called (d1,d2)-arithmetic sequence ≤i≤n) such that ≤j& ...

  4. 水题 等差数列HDU 5400 Arithmetic Sequence

    主要是要知道它对于等差数列的定义,单个数也可以作为等差数列且一定满足题意,另外就是要算清楚区间与区间的关系,考虑两大类情况,一种是d1区间和d2区间连在一起,另外一种情况就是其余情况. #includ ...

  5. (模拟)Arithmetic Sequence -- HDU -- 5400

    链接: http://acm.hdu.edu.cn/showproblem.php?pid=5400 Time Limit: 4000/2000 MS (Java/Others)    Memory ...

  6. Arithmetic Sequence(dp)

    Arithmetic Sequence Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 51  Solved: 19[Submit][Status][We ...

  7. [Swift]LeetCode1027. 最长等差数列 | Longest Arithmetic Sequence

    Given an array A of integers, return the length of the longest arithmetic subsequence in A. Recall t ...

  8. HZAU 21——Arithmetic Sequence——————【暴力 or dp】

    Arithmetic Sequence Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 1810  Solved: 311[Submit][Status] ...

  9. 华中农业大学第四届程序设计大赛网络同步赛-1020: Arithmetic Sequence,题挺好的,考思路;

    1020: Arithmetic Sequence Time Limit: 1 Sec  Memory Limit: 128 MB Submit:  ->打开链接<- Descriptio ...

随机推荐

  1. 物联网操作系统HelloX已成功移植到MinnowBoard MAX开发板上

    在HelloX开发团队的努力下,以及Winzent Tech公司(总部在瑞典斯德哥尔摩)的支持下,HelloX最新版本V1.78已成功移植到MinnowBoard MAX开发板上.相关源代码已经发布到 ...

  2. dede调用第一张大图,非缩略图

    1.找到include/extend.func.php加入现在函数 function firstimg($str_pic) { $str_sub=substr($str_pic,0,-7)." ...

  3. Web开发基础

    一.后台 1.MyEclipse:Java Web的编辑器 2.Java Servlet:后台代码 3.Velocity:前后台接口 4.mySql:数据库 二.前台 1.js:前台代码 2.jQue ...

  4. 删除binlog的方法

    不知道你有没有为mysql的binlog占用大量磁盘感到无奈,my.cnf里binlog的size可以设置多大做分割,但没有看到删除的配置,在mysql里show了一下variables, mysql ...

  5. ASP.NET静态页生成

    由于业务需要,得把页面按照模板页生成静态页面,所以自己就琢磨了下,写些思路,以备日后需要的时候用. 静态页生成用到最多的就是匹配跟替换了,首先得读取模板页的html内容,然后进行你自己定义的标签匹配, ...

  6. ajax url参数中文乱码解决

    1.较好的处理办法,对js的url中的中文参数值使用两次encodeURI(),即 encodeURI(encodeURI("url的中文参数值")), java代码中使用URLD ...

  7. jQuery插件开发的模式和结构

    jQuery插件开发 一般来说,jQuery插件的开发分为两种:一种是挂在jQuery命名空间下的全局函数,也可称为静态方法:另一种是jQuery对象级别的方法,即挂在jQuery原型下的方法,这样通 ...

  8. BITMAP CONVERSION FROM ROWIDS

    在有些执行计划中,可以会看到 BITMAP CONVERSION FROM ROWIDS这样的东东,也许你会感觉奇怪,我没有使用位图索引怎么出现了bitmap.我通过一个sql和大家分析下原因:sql ...

  9. PHP时间格式控制符对照表

    format 字符 说明 返回值例子 日 --- --- d 月份中的第几天,有前导零的 2 位数字 01 到 31 j 月份中的第几天,没有前导零 1 到 31 S 每月天数后面的英文后缀,2 个字 ...

  10. HTML5新增属性

    [sourcecode language="plain"] <!DOCTYPE html> <html manifest="cache.manifest ...