看来不是脸的问题,还是自己打比赛太少了……
1 #include <cstdio> 2 #include <cstdlib> 3 #include <cmath> 4 #include <cstring> 5 #include <string> 6 #include <set> 7 #include <map> 8 #include <list> 9 #include <stack> 10 #include <queue> 11 #include <vector> 12 #include <algorithm> 13 #include <iostream> 14 using namespace std; 15 #define ll long long 16 #define inf 1e9 17 const long maxn=1e5+5; 18 const ll mod=1e9+7; 19 20 double p[10]={0.005,0.01,0.02,0.05}; 21 double q[10]; 22 23 int main() 24 { 25 long i; 26 for (i=0;i<4;i++) 27 q[i]=1-p[i]; 28 for (i=0;i<4;i++) 29 { 30 //q^t<0.5 t<log(0.5)/log(q) q<1,log(q)<>0 31 printf("percentage = %.4f ",p[i]); 32 printf("=0.5 times = %.4f ",log(1-0.5)/log(q[i])); 33 printf("=0.8 times = %.4f ",log(1-0.8)/log(q[i])); 34 printf("=0.9 times = %.4f ",log(1-0.9)/log(q[i])); 35 printf(" "); 36 } 37 return 0; 38 }