\(problem\)

这种题目需要一个定理

\(a[1]+a[2]+a[3]+a[4]...=(a[1]%mod)+...\) 本人出奇的懒

然后 动态规划?(恰似枚举)

#include <bits/stdc++.h>
using namespace std ;
typedef long long LL ;
const int N = 10000 + 10 ;
LL s , t ;
LL d[4];
LL dp[N][4] ;
signed main() {
ios::sync_with_stdio(false) ; memset(dp,0,sizeof(dp)) ;
cin >> s >> t ;
for(register int i=1;i<=4;i++) cin >> d[i] ;
for(register int i=1;i<=4;i++) dp[1][i] = dp[2][i] = 1%d[i] ;
for(register int i=2;i<=N;i++)
for(register int j=1;j<=4;j++) dp[i][j] = (dp[i-1][j] + dp[i-2][j]) % d[j] ;
#ifdef debug
for(register int i=s;i<=t;i++){
for(register int j=1;j<=4;j++) cout << dp[i][j] <<' ' ;
cout << endl ;
}
#endif
for(register int i=s;i<=t;i++){
bool f = false ;
for(register int j=1;j<=4;j++) if(dp[i][j] == 0) f = true ;
if(!f) cout << i << ' ' ;
}
return 0 ;
}

随机推荐

  1. python3支持excel读写

    1.安装setuptools-17.0.tar.gz cmd 进入命令行 cd C:\Users\vivi\Desktop\pythonforexcel\setuptools-17.0\setupto ...

  2. software collection

    software software Table of Contents 1. Privacy 2. GFW 2.1. google search 2.2. 修改 DNS 服务器 2.2.1. 修改ip ...

  3. Promise对象和回调函数,解决异步数据传递问题

    下面的代码例子,均已小程序的异步请求数据为案例来说明 1.利用回调函数,来解决异步数据传递问题 异步操作api.js const getBooks = (url, callback) => { ...

  4. 【模板】51nod 1006 最长公共子序列Lcs

    [题解] dp转移的时候记录一下,然后倒着推出答案即可. #include<cstdio> #include<cstring> #include<algorithm> ...

  5. [bzoj1833][ZJOI2010][count] (数位dp)

    Description 给定两个正整数a和b,求在[a,b]中的所有整数中,每个数码(digit)各出现了多少次. Input 输入文件中仅包含一行两个整数a.b,含义如上所述. Output 输出文 ...

  6. Display PowerPoint slide show within a VB form or control window

    The example below shows how to use VB form/control as a container application to display a PowerPoin ...

  7. ECMAScript 6 入门学习笔记(二)——变量的解构赋值

    一.数组的解构赋值 let [foo, [[bar], baz]] = [1, [[2], 3]]; ①可多不可少,等号的右边是数组 let [x, y] = [1, 2, 3]; //可以 let ...

  8. 杨辉三角的打印(Java)

    // //输入指定的行数,打印杨辉三角 // //每个数等于它上方两数之和. //每行数字左右对称,由1开始逐渐变大. //第n行的数字有n项. // // // //可从打印菱形的思想出发:???? ...

  9. Ubuntu 16.04安装uGet替代迅雷,并在Chrome中设置为默认下载器

    uGet是采用aria2作为下载后端,所以两个软件都必须同时安装. 1.安装uGet sudo add-apt-repository ppa:plushuang-tw/uget-stable sudo ...

  10. token的生成规则

    1.token生成规则要添加时间戳,timestamp,以便解析token时,可以根据判断时间超过30分钟不予处理.像session过期时间一样.