Codeforces Round #523 (Div. 2)C(DP,数学)
#include<bits/stdc++.h>
using namespace std;
long long a[100007];
long long dp[1000007];
const int mod=1e9+7;
int main(){
int n;
scanf("%d",&n);
dp[0]=1;
for(int i=1;i<=n;i++)
scanf("%lld",&a[i]);
for(int i=1;i<=n;i++){
vector<long long>v;
for(int j=1;j*j<=a[i];j++){
if(a[i]%j==0){
v.push_back(j);
if(j*j!=a[i])
v.push_back(a[i]/j);
}
}
sort(v.begin(),v.end());
reverse(v.begin(),v.end());
for(auto &it: v){
dp[it]+=dp[it-1];
dp[it]%=mod;
}
}
long long ans=0;
for(int i=1;i<=n;i++)
ans+=dp[i];
ans%=mod;
printf("%lld",ans);
return 0;
}

Codeforces Round #523 (Div. 2)C(DP,数学)的更多相关文章
- Codeforces Round #523 (Div. 2)
Codeforces Round #523 (Div. 2) 题目一览表 来源 考察知识点 完成时间 A Coins cf 贪心(签到题) 2018.11.23 B Views Matter cf 思 ...
- Codeforces Round #523 (Div. 2) C Multiplicity (DP)
传送门 https://www.cnblogs.com/violet-acmer/p/10005351.html 题意: 给定一数组a[],从a[ ]中除去任意个元素得到b[ ],求能形成多少“好序列 ...
- 严格递增类的dp Codeforces Round #371 (Div. 1) C dp
http://codeforces.com/contest/713 题目大意:给你一个长度为n的数组,每次有+1和-1操作,在该操作下把该数组变成严格递增所需要的最小修改值是多少 思路:遇到这类题型, ...
- 很好的一个dp题目 Codeforces Round #326 (Div. 2) D dp
http://codeforces.com/contest/588/problem/D 感觉吧,这道题让我做,我应该是不会做的... 题目大意:给出n,L,K.表示数组的长度为n,数组b的长度为L,定 ...
- Codeforces Round #548 (Div. 2) C dp or 排列组合
https://codeforces.com/contest/1139/problem/C 题意 一颗有n个点的树,需要挑选出k个点组成序列(可重复),按照序列的顺序遍历树,假如经过黑色的边,那么这个 ...
- Codeforces Round #536 (Div. 2) E dp + set
https://codeforces.com/contest/1106/problem/E 题意 一共有k个红包,每个红包在\([s_i,t_i]\)时间可以领取,假如领取了第i个红包,那么在\(d_ ...
- Codeforces Round #541 (Div. 2) G dp + 思维 + 单调栈 or 链表 (连锁反应)
https://codeforces.com/contest/1131/problem/G 题意 给你一排m个的骨牌(m<=1e7),每块之间相距1,每块高h[i],推倒代价c[i],假如\(a ...
- Codeforces Round #543 (Div. 2) F dp + 二分 + 字符串哈希
https://codeforces.com/contest/1121/problem/F 题意 给你一个有n(<=5000)个字符的串,有两种压缩字符的方法: 1. 压缩单一字符,代价为a 2 ...
- Codeforces Round #304 (Div. 2) D 思维/数学/质因子/打表/前缀和/记忆化
D. Soldier and Number Game time limit per test 3 seconds memory limit per test 256 megabytes input s ...
随机推荐
- HDU 4714 Tree2cycle:贪心
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4714 题意: 给你一棵树,添加和删除一条边的代价都是1.问你将这棵树变成一个环的最小代价. 题解: 贪 ...
- HTML-CSS浮动元素详解
浮动定位是指 1.1将元素排除在普通流之外,即元素将脱离标准文档流 1.2元素将不在页面占用空间 1.3将浮动元素放置在包含框的左边或者右边 1.4浮动元素依旧位于包含框之内 2. 浮动的框可以向左或 ...
- LSM Tree 学习笔记——本质是将随机的写放在内存里形成有序的小memtable,然后定期合并成大的table flush到磁盘
The Sorted String Table (SSTable) is one of the most popular outputs for storing, processing, and ex ...
- BEC listen and translation exercise 37
You're supposed to do that before 10.30 in the morning, but obviously, if it's an emergency, you can ...
- bzoj-2458 2458: [BeiJing2011]最小三角形(计算几何+分治)
题目链接: 2458: [BeiJing2011]最小三角形 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 1101 Solved: 380 Des ...
- cocos2d-x 之 CCParticleBatchNode CCParallaxNode
//不使用 CCParticleBatchNode : 注意比较 左下角的显示信息 ; i<; ++i) { CCParticleSystem* particleSystem = CCParti ...
- rtmp与hls流媒体服务器搭建:ubuntu下Nginx搭建初探与rtmp-module的添加
关键词:Nignx(http服务器):rtmp,hls(流媒体服务) 前言:感谢开源,感谢战斗民族.现在在做流媒体服务的一些工作,流媒体服务器搭建的网上教程多入牛毛,但是细细查看,发现很多同志贴上来的 ...
- loj516dp一般看规律
STL 这...我只能说是...考得是... STL的正确用法? #include<iostream> #include<cstdio> #include<cstdlib ...
- SPOJ705 Distinct Substrings (后缀自动机&后缀数组)
Given a string, we need to find the total number of its distinct substrings. Input T- number of test ...
- python密钥登录主机
#!/usr/bin/python # -*- coding:utf-8 -*- ################################### # # 检查主机的损坏磁盘 # ####### ...