标签:
多边形的组成条件是最长边不能占边长总和的一半,将木棒想象成圆多砍一刀,然后是简单概率.
Description
|
![]() |
/* ***********************************************
Author :CKboss
Created Time :2015年01月30日 星期五 21时37分11秒
File Name :UVA11971.cpp
************************************************ */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long int LL;
int n;
LL gcd(LL a,LL b)
{
if(b!=0) return gcd(b,a%b);
return a;
}
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int T_T,cas=1;
scanf("%d",&T_T);
while(T_T--)
{
scanf("%*d%d",&n);
LL fenzhi = (1LL<<n)-n-1;
LL fenmu = (1LL<<n);
LL g = gcd(fenzhi,fenmu);
printf("Case #%d: %lld/%lld\n",cas++,fenzhi/g,fenmu/g);
}
return 0;
}
标签:
原文地址:http://blog.csdn.net/ck_boss/article/details/43316495