【dp+离散化】hdu 4028
来源:互联网 发布:淘宝人工服务电话号码 编辑:程序博客网 时间:2024/05/23 20:17
用map离散
#include <map>#include <set>#include <list>#include <queue>#include <deque>#include <stack>#include <string>#include <time.h>#include <cstdio>#include <math.h>#include <iomanip>#include <cstdlib>#include <limits.h>#include <string.h>#include <iostream>#include <algorithm>using namespace std;#define LL long long#define PI acos(-1.0)#define N 1005#define MAX INT_MAX#define MIN INT_MIN#define eps 1e-8#define FRE freopen("a.txt","r",stdin)map<LL, LL> mp[43];LL gcd(LL a,LL b){ return (b==0) ? a:gcd(b,a%b);}LL lcm(LL a,LL b){ return a*b/gcd(a,b);}void DP(){ LL i; mp[1][1]=1; for(i=2;i<=40;i++){ mp[i]=mp[i-1]; mp[i][i]++; map<LL ,LL>::iterator it; for(it=mp[i-1].begin();it!=mp[i-1].end();it++){ LL lc=lcm(i,it->first); mp[i][lc]+=it->second; } }}int main(){ DP(); int t; int ca=1; scanf("%d",&t); while(t--){ int n; LL m; scanf("%d %I64d",&n,&m); map<LL ,LL>::iterator i; LL ans=0; for(i=mp[n].begin();i!=mp[n].end();i++){ if(i->first>=m) ans+=i->second; } printf("Case #%d: %I64d\n",ca++,ans); } return 0;}
- 【dp+离散化】hdu 4028
- hdu 5009 dp+离散化
- hdu 4028 The time of a day(离散化dp)
- HDU 3607 线段树+离散化+DP
- hdu 3616 Milking Time dp 离散化
- 【树状数组 + 离散化 + DP】 HDU 5542
- HDU 4028 The time of a day(11年上海 离散化DP)
- HDU 4028 The time of a day By Assassin dp+离散化!
- HDU - 4028 The time of a day(离散+DP)
- HDU 3450 Counting Sequences(树状数组+DP+离散化)
- hdu 5009 离散化+链表+dp
- hdu 3450 离散化+dp+线段树优化
- HDU 2836 Traversal(线段树+离散化+DP)
- HDU 5542 ccpc 树状数组优化dp +离散化
- HDU 3016 Man Down(线段树+离散化+dp)
- hdu3666 离散化dp
- Millionare_离散化&&DP
- hdu 5489 Removed Interval 2015合肥网络赛 树状数组 dp 离散化/dp
- [Mac OS X] 内核、驱动调试 - Kernel Debug Kit---kernel panic 调试&分析
- 拍照-----------android系统 至关重要的功能
- zoj1091_hdu1372_Knight Moves
- 转:Eclipse快捷键大全
- 【ZT】delete this的使用
- 【dp+离散化】hdu 4028
- C++设计模式-原型模式
- ioremap在中断处理函数中会导致错误
- eclipse中选中的变量以指定颜色高亮显示
- 醒了,看欧冠
- 10个经典的Android开源应用项目- android入门
- why copy constructor don't need to check 3 things
- Debugging VBA zz
- windows api - socket 函数大全