[杂题] Codeforces 407B #239 (Div. 1) B. Long Path
来源:互联网 发布:数据库怎么添加数据 编辑:程序博客网 时间:2024/05/17 22:57
我们可以发现当我们走到第一次
就不难得出
#include<cstdio>#include<cstdlib>#include<algorithm>using namespace std;typedef long long ll;const int P=1e9+7;const int N=1005;int n,f[N];int main(){ freopen("t.in","r",stdin); freopen("t.out","w",stdout); scanf("%d",&n); f[1]=0; int p; for (int i=1;i<=n;i++) { scanf("%d",&p); f[i+1]=((ll)f[i]+1+f[i]+P-f[p]+1)%P; } printf("%d\n",f[n+1]); return 0;}
0 0
- [杂题] Codeforces 407B #239 (Div. 1) B. Long Path
- CodeForces 407B Long Path
- CodeForces 407B Long Path
- codeforces 407B B. Long Path(dp)
- Long Path - CodeForces 407B dp
- CodeForces 407B Long Path ( DP )
- codeforces-407B Long Path(dp)
- cf Round #239 (Div. 1) B. Long Path
- Codeforces 407B Long Path【dp】好题
- CF 407B - Long Path
- Codeforces Round #228 (Div. 1)-B-Fox and Minimal path
- Codeforces Round #228 (Div. 1) B. Fox and Minimal path
- CF - 407 - B. Long Path(dp)
- 【CODEFORCES】 B. Long Jumps
- Codeforces Round #239 (Div. 1)(A,B)
- Codeforces Round #407 (Div. 1) B
- Codeforces Round #407 (Div. 1):B
- Codeforces Round #237 (Div. 2) / 404B Marathon (fmod或long long表示浮点)
- go搭建一个简单web服务器
- 以Wave格式为例的音频文件合成
- 【OM】认识磁盘阵列
- Caffe安装,Caffe-face安装, 双操作系统
- MySQL安装图解
- [杂题] Codeforces 407B #239 (Div. 1) B. Long Path
- Hrbust 1650 Mac and Sequence【二进制思维】好题~
- com.sun.xml.internal.ws.model.RuntimeModelerException:
- 派生类构造函数和析构函数的构造规则
- B树,B+树,B*树相关知识以及Mysql数据库中的两种引擎
- HashMap的遍历
- 2. 产品的主线与产品的爆点
- Zookeeper与Kafka集群搭建
- Android基础知识梳理之View相关知识一