#include <stdio.h>
#include <map>
using namespace std;
typedef long long ll;
map<ll,ll> dp[50];
ll gcd(ll a, ll b)
{
return a%b?gcd(b, a%b):b;
}
ll lcm(ll a,ll b)
{
return a / gcd(a, b) * b;
}
void init()
{
dp[1][1]=1;
map<ll,ll>::iterator it;
for(int i=2;i<=40;i++)
{
dp[i]=dp[i-1];
dp[i][i]++;
for(it=dp[i-1].begin();it!=dp[i-1].end();it++)
{
dp[i][lcm(it->first,i)]+=it->second;
}
}
}
int main()
{
int i,j,k;
int n;
ll m;
int t,icase;
scanf("%d",&t);
init();
for(icase=1;icase<=t;icase++)
{
ll ans=0;
scanf("%d%lld",&n,&m);
map<ll,ll>::iterator it;
for(it=dp[n].begin();it!=dp[n].end();it++)
{
if(it->first>=m)
ans+=it->second;
}
printf("Case #%d: %lld\n",icase,ans);
}
return 0;
}
HDU 4028 The time of a day
最新推荐文章于 2019-09-29 17:14:43 发布