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 |
Re:我做的CIn Reply To:Re:我做的C Posted by:820517 at 2004-09-30 12:47:32 #include<iostream> using namespace std; int cal(float dest){ int n=1; float sum=0; while(sum<dest){ sum+=1.0/(n+1); n++; } return --n; } void main(void){ int n; float in; cin>>in; while(in!=0.00){ n=cal(in); cout<<n<<" card(s)"<<endl; cin>>in; } } 晕,这个就通过了。 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator