题意:http://www.lightoj.com/volume_showproblem.php?problem=1104
#include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<queue> #include<map> #include<vector> #include<math.h> #include<string> using namespace std; #define INF 0x3f3f3f3f #define LL long long #define N 10006 #define Lson rood<<1 #define Rson rood<<1|1 int main() { int T,t=1; scanf("%d",&T); while(T--) { int n; scanf("%d",&n); int ans=0; double sum=1.0; while(1) { sum*=1.0*(n-ans)/n; if(1-sum>=0.5) break; ans++; } printf("Case %d: %d ",t++,ans); } return 0; }