看书书上讲的很明白了...
#include<cstdio>
#include<cstring>
long long gcd(long long a,long long b)
{
return b==0?a:gcd(b,a%b);
}
int main()
{
int t;
scanf("%d",&t);
int n,k;
int kase=0;
while(t--)
{
kase++;
scanf("%d%d",&n,&k);
long long up=((long long)1<<k)-(k+1);
long long down=(long long)1<<k;
long long gg=gcd(up,down);
up=up/gg;
down=down/gg;
// printf("Case #%d: %I64d/%I64d\n",kase,up,down);
printf("Case #%d: %lld/%lld\n",kase,up,down);
}
return 0;
}