3?3?HDU 4525_系?鸡
?a href="http://acm.hdu.edu.cn/showproblem.php?pid=4525">
大水严??说?
以?a(n+1)=(k1+k2)*an_int64ؾ谸__int64?正解ouble,A両件1,k2(说 似乲? =)?迱室inf??/p>
#include <iostream>#include <cstring>using namespace std;int main(){double res,k1,k2,notbig;int testcase;cin>>testcase;for(int a=1;a<=testcase;a++){res=0;int orgn;double temp;int count=0;cin>>orgn>>k1>>k2>>notbig;for(int i=0;i<orgn;i++){cin>>temp;res+=temp;}if(res>notbig){cout<<"Case #"<<a<<": "<<0<<endl;}else if(k1+k2>=-1 && k1+k2<=1){cout<<"Case #"<<a<<": "<<"inf"<<endl;}else{while(res<=notbig){res*=(k1+k2);count++;}cout<<"Case #"<<a<<": "<<count<<endl;}}return 0;}