题目链接: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. 关于Latent Dirichlet Allocation

    今天,也没出去,晚上宿舍没有人,自己思考了下人生,毕设还是大事,觉得现在有必要把LDA从前往后彻彻底底的读一遍了,因为现在的感觉就是什么都知道一点皮毛,但是理解的都不深,LDA好像(恩,相当不好)现在 ...

  2. jQuery学习备忘

    jQuery对象转换成DOM对象 var #cr = $("#cr"); //jQuery对象 var cr = $cf[0]; //DOM对象 alert(cr.checked) ...

  3. jquery easyui datagrid字段绑定问题

    表字段为G_XIAN,生成PO对象时为private String GXian; datagrid字段必须写为gXian,否则数据无法正确绑定. 总结:不管VO对象中字段名称首字母是否大写,在data ...

  4. 职业操盘手内部教材 z

    重 点抢筹区:   是主力机构在低位拉高建仓后的一个相当尴尬的区域!因为在这个区域,场外的绝大多数投资者不敢买,而场内持有的人却很想卖!所以会出现成片的卖盘挂单! 由于主力向上做的意图已经非常明显,所 ...

  5. Selenium启动本地firefox的profile

    ProfilesIni pi = new ProfilesIni();FirefoxProfile profile = pi.getProfile("default");WebDr ...

  6. Linux基本命令 目录

    Linux基本命令 目录 Linux基本命令(1)管理文件和目录的命令 Linux基本命令(2)有关磁盘控件的命令 Linux基本命令(3)文件备份和压缩的命令 Linux基本命令(4)有关关机和查看 ...

  7. ORA-12516: TNS: 监听程序无法找到匹配协议栈的可用句柄解决方法

    1.查看当前连接进程数SQL>select count(*) from v$process;2.查看连接数上限SQL>select value from v$parameter where ...

  8. CMDB反思4

    CMDB模型设计2 http://blog.vsharing.com/xqscool/A1275233.html 估计大家看到破子的这两篇都有点晕哈,我也有点晕. 两篇对比来看.   第1处,属性部分 ...

  9. VS 2013 EFSQLITE

    在 vs 2013 上用 1.NuGet程序包来获取,它也会自动下载EF6的包 :system.Data.sqlite 他会自动下载 其它几个需要的包. 2.在Sqlite官网上下载对应的版本:htt ...

  10. SlidingPaneLayout的基本使用

      SlidingPaneLayout是V4包中新添加的组件,可以实现两列面板的切换.说先来看看API文档的说明: ? 1 SlidingPaneLayout provides a horizonta ...