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 |
在下草鸟一个啊 麻烦哪位前辈指点一下啊! 先谢谢了#include<iostream> #include <cmath> using namespace std; int main() { float a; while(cin>>a) { double sum=0; for(long i=2;i<=1000000;i++) { sum=sum+(double)1/i; if(a<=sum) { cout<<i-1<<" card(s)"<<endl; break; } } } system("pause"); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator