$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 ;
}
随机推荐
- L2-014. 列车调度(带图详解)
L2-014. 列车调度 火车站的列车调度铁轨的结构如下图所示. Figure 两端分别是一条入口(Entrance)轨道和一条出口(Exit)轨道,它们之间有N条平行的轨道.每趟列车从入口可以选 ...
- textarea 高度调整
textarea 高度调整 通过 rows 属性调整 高度
- 一、ECharts简介
ECharts,缩写来自Enterprise Charts,商业级数据图表,一个纯Javascript的图表库,可以流畅的运行在PC和移动设备上,兼容当前绝大部分浏览器(IE6/7/8/9/10/11 ...
- Hello Shiro
[HelloWorld Shiro] 1.搭建开发环境-加入jar包 2.步骤(前提:已下载好Shiro资源包): ①找到shiro-root-1.2.3-source-release包, ②按Apa ...
- 【Codeforces 567D】One-Dimensional Battle Ships
[链接] 我是链接,点我呀:) [题意] 长度为n的一个序列,其中有一些部分可能是空的,一些部分是长度为a的物品的一部分 (总共有k个长度为a的物品,一个放在位置i长度为a的物品会占据i,i+1,.. ...
- 如何相互转换逗号分隔的字符串和List --https://blog.csdn.net/yywusuoweile/article/details/50315377
如何相互转换逗号分隔的字符串和List ---https://blog.csdn.net/yywusuoweile/article/details/50315377 方法 2: 利用Guava的Joi ...
- Why does MySQL produce so many temporary MYD files?
http://dba.stackexchange.com/questions/30505/why-does-mysql-produce-so-many-temporary-myd-files Data ...
- [HDU3586]Information Disturbing(DP + 二分)
传送门 题意:给定一个带权无向树,要切断所有叶子节点和1号节点(总根)的联系,每次切断边的费用不能超过上限limit,问在保证总费用<=m下的最小的limit 二分答案,再 DP,看看最终结果是 ...
- Java 学习(6):java Number & Math & String & 数组...常用类型
目录 --- Number & Math类 --- Character 类 --- String 类 --- StringBuffer 类 --- 数组 Number & Math类: ...
- leetcode算法学习----155. 最小栈(MinStack )
下面题目是LeetCode算法155题: https://leetcode.com/problems/min-stack/ 题目1:最小函数min()栈 设计一个支持 push,pop,top 操作, ...