题目链接: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. windows下用mingw编译linux项目

    1.下载安装mingw32 2.将mingw下bin和msys\1.0下bin设置为系统path 3.启动msys.bat 4.cd到项目目录 5.输入./configure 6.输入make 7.输 ...

  2. UVa11582 Colossal Fibonacci Numbers!

    #include<cstdio> #include<iostream> #include<cstring> #include<algorithm> us ...

  3. ORACLE创建、修改、删除序列

    ORACLE没有象SQL SERVER中一样的自增加字段,要实现只能通过SEQUENCE来实现. 1.创建序列语法:(需要CREATE SEQUENCE系统权限) CREATE SEQUENCE 序列 ...

  4. requirejs之demo (转)

    具体的理论就不讲了,可以参考 http://www.ruanyifeng.com/blog/2012/10/javascript_module.html http://www.ruanyifeng.c ...

  5. 解决键盘上符号打出来的和标着的不一样的错误&不能用ctrl+space切换输入法错误

    0.右键输入法栏,点设置 1.增加”美式键盘“ 2.切换“默认键盘”为美式 3.删除“英式键盘” 4.高级键设置,改为ctrl+space

  6. linux 修改时间 - [命令操作]

    我们一般使用“date -s”命令来修改系统时间.比如将系统时间设定成1996年6月10日的命令如下. #date -s 06/10/96 将系统时间设定成下午1点12分0秒的命令如下. #date ...

  7. pdf Factory的设置

    将文件自动保存到其它位置的设置方法(以Excel文件打印为例):

  8. A woman without arms

    任吉美出生在中国烟台海阳一个极为普通的渔民家里.她先天残疾,没有胳膊和手. 小吉美注定要比别人生活得更艰难.她不能自己穿衣,不能自己端碗吃饭,也不能像兄弟姐妹们一样帮助妈妈干家务活,她觉得自己成了家里 ...

  9. unity3d Hair real time rendering 真实头发实时渲染(转)

    惊现塞拉酱 算法是Weta Digital根据siggraph2003的论文加以改进,改进之前使用的是Kajiya and Kay’s 模型,它能量不守恒,也就是说不是基于物理的,不准确 电镜下真实头 ...

  10. (转)MFC消息机制

    转自:http://blog.csdn.net/kongfuxionghao/article/details/35882533