标签:eterm between rtu comm lin time rip gcd arch
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)
Total Submission(s): 1297 Accepted Submission(s): 594
#include<map> #include<cstdio> using namespace std; typedef long long ll; map<ll,ll>f[45];ll m,ans;int n,cas,Cas; map<ll,ll>::iterator it,ii; ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);} ll lcm(ll a,ll b){return a/gcd(a,b)*b;} int main(){ f[1][1]=1; for(int i=1;i<=40;i++){ f[i]=f[i-1]; f[i][i]++; for(it=f[i-1].begin();it!=f[i-1].end();it++){ f[i][lcm(it->first,i)]+=it->second; } } for(scanf("%d",&Cas),cas=1;cas<=Cas;cas++){ scanf("%d%I64d",&n,&m);printf("Case #%d: ",cas); ans=0; for(it=f[n].begin();it!=f[n].end();it++){ if(it->first>=m) ans+=it->second; } printf("%I64d\n",ans); } return 0; }
hdu4028 The time of a day[map优化dp]
标签:eterm between rtu comm lin time rip gcd arch
原文地址:http://www.cnblogs.com/shenben/p/6711084.html