HDU-5981-Guess the number-规律
来源:互联网 发布:程序员试用期转正申请 编辑:程序博客网 时间:2024/06/08 13:26
答案是打表发现有规律。
然而没有看懂网上DP打表的过程。。。
在vj上看到了别人的代码。真真好。
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstdio>using namespace std;const int maxn=4010;const int mod=100000073;int c[maxn][maxn];int ra[maxn*maxn];int rb[maxn*maxn];int main(){ for(int i=0;i<maxn;i++) {c[i][0]=c[i][i]=1; //c[i][i]=1; } for(int i=1;i<maxn;i++) for(int j=1;j<i;j++) c[i][j]=(c[i][j-1]+c[i-1][j])%mod; int tot=1; for(int i=1;i<maxn;i++) for(int j=i-1;j>=0;j--) { ra[tot]=i; rb[tot]=c[i][j]; tot++; } int a,b; for(int i=1;i<20;i++) cout<<ra[i]<<" "<<rb[i]<<endl; //for(int j=1;j<tot) while(scanf("%d%d",&a,&b)==2) { int n=b-a+1; printf("%d %d\n",ra[n],rb[n]); } return 0;}
阅读全文
0 0
- HDU-5981-Guess the number-规律
- HDU 5981 Guess the number
- 2016 大连 K Guess the number HDU 5981 DP 打表找规律
- hdu 5981:Guess the number 动态规划
- HDU-5981 Guess the number(DP)
- hdu 1562 Guess the number
- hdu 1562 Guess the number
- HDU 1562 Guess the number
- HDU 1562 Guess the number
- HDU 1562 Guess the number
- hdu.1562.Guess the number
- hdu-oj 1562 Guess the number
- 1562 Guess the number
- Guess the Number
- HDOJ1562 Guess the number
- HDU 5981 && 2016ICPC大连 K: Guess the number(推理)
- 杭电 HDU ACM 1562 Guess the number
- HDOJ(HDU) 1562 Guess the number(水题,枚举就行)
- Codevs : 1033 蚯蚓的游戏问题 (费用流
- notifyDataSetChanged()无效原因
- milk3-section1.4
- Http协议基础之HTTP请求首部字段
- HTTP协议学习笔记01
- HDU-5981-Guess the number-规律
- 泡影产品需求设计文档
- bzoj3122 随机数生成器 BSGS+费马小定理求逆元
- HashMap与HashTable详解与区别
- 洛谷 P1829 半数集问题
- 使用scala实现wordcount的简单计数
- [leetcode]508. Most Frequent Subtree Sum
- JAVA学习笔记——List集合
- jquery/css实现步骤条