#include<bits/stdc++.h> using namespace std; typedef long long ull; ull gcd(ull a,ull b){ if(b == 0) return a; return gcd(b,a%b); } int main(){ ull t,n,k,cnt = 0,temp,a,b,c; cin >> t; while(t--){ cnt++; cin >> n >> k; // scanf("%ulld %ulld",&n,&k); a = k+1; b = ((long long)1<<k);//这里 1 很重要 //cout << k << " " << b << endl; temp = gcd(b,a); a = a/temp; b = b/temp; c = b - a; printf("Case #%d: ",cnt); cout << c << "/" << b << endl; } return 0; }
原文地址:https://www.cnblogs.com/zhibin123/p/10882788.html
时间: 2024-11-05 14:52:43