Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
那位大虾帮忙看看,那出错了,谢谢In Reply To:小弟菜鸟一个哪位大哥帮看看哪错了!!!!! Posted by:baohan45 at 2010-01-23 16:06:22 #include <iostream> using namespace std; float Hangover(int n) { int i; float m=0.00; for(i=1;i<=n;i++) m+=1.0/(i+1); return m; } int main() { float c; while(cin>>c) { if(c==0.00) break; else { if(c>=0.01&&c<0.50) { cout<<"1 card(s)"<<endl; break; } else for(int i=1;i<=273;i++) if(Hangover(i)>=c) { cout<<i<<" card(s)"<<endl; break; } } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator