$tsinsenA1067$
\(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 ;
}
随机推荐
- Ubuntu notes
ubuntu notes Table of Contents 1. backup data 2. Basics Ubuntu 3. Install, uninstall packages 4. Bas ...
- 2.js原型的基本概念
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 带你全面分析嵌入式linux系统启动过程中uboot的作用
资料链接:http://mp.weixin.qq.com/s/rYVchD-xy7Bdkc1O3fW2Wg
- 洛谷 2471 BZOJ 1067 [SCOI2007]降雨量
[题解] 用线段树维护区间最大值(因为没有修改,St表也可以),然后由于x,y可能是降雨量未知的年份,需要进行分类讨论. #include<cstdio> #include<algo ...
- POJ 3630
Phone List Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20894 Accepted: 6532 Descripti ...
- Ubuntu安装vnc 解决乱码
https://blog.csdn.net/dddxxxx/article/details/53580789 https://www.centos.bz/2017/12/%E8%A7%A3%E5%86 ...
- CentOS 安装Oracle 11g R2
CentOS 安装Oracle 11g R2 学习了-/ https://www.osyunwei.com/archives/5445.html
- python实现汉诺塔算法
汉诺塔 算法分析 1.步骤1:如果是一个盘子,直接将a柱子上的盘子从a移动到c 否则 2.步骤2:先将A柱子上的n-1个盘子借助C移动到B(图1) 已知函数形参为hanoi(n,a,b,c),这里调用 ...
- Mysql Innodb存储引擎 insert 死锁分析
http://chenzhenianqing.cn/articles/1308.html
- java编程思想——java IO系统
一.什么是IO io在本质上是单个字节的移动.而流能够说是字节移动的载体和方式,它不停的向目标处移动数据.我们要做的就是依据流的方向从流中读取数据或者向流中写入数据. 二.java中支持IO操作的库类 ...