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 |
ac打卡#include <iostream> using namespace std; double cal(int n) { float sum=0; for (int i=2;i<=n+1;i++) { sum = sum + (1.0/i); //cout<<1.0/i<<"**"<<endl; } return sum; } int main() { double m; cin>>m; while(m!=0) { for(int i=0;i<300;i++) { if(cal(i)>=m) { cout<<i<<" card(s)"<<endl; break; } } cin>>m; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator