标签:
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 3081 Accepted Submission(s): 637
#include<stdio.h> #include<string.h> #include <iostream> using namespace std; const int N = 10005; double a[N],temp[N]; int main() { int tcase; scanf("%d",&tcase); int t = 1; while(tcase--){ int n; double k1,k2,k,sum=0; scanf("%d%lf%lf%lf",&n,&k1,&k2,&k); for(int i=1;i<=n;i++){ scanf("%lf",&a[i]); sum += a[i]; } if(sum>k){ printf("Case #%d: 0\n",t++); continue; } if(k1+k2<=1&&k1+k2>=-1) { printf("Case #%d: inf\n",t++); continue; } int cnt=0; while(sum<=k){ double pre = sum; sum = sum*(k1+k2); cnt++; } printf("Case #%d: ",t++); printf("%d\n",cnt); } return 0; }
标签:
原文地址:http://www.cnblogs.com/liyinggang/p/5618092.html