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> using namespace std; int f(double num ) { double i,sum=0; for( i=2;sum<num;i+=1){ sum+=1/i; } return (int)i-2; } int main() { double num=1; while(num!=0.0){ cin>>num; cout<<f(num)<<" card(s)"<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator