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 |
写第一个程序就wrong answer,大家帮忙看看那#include<iostream> using namespace std; int number(float f) { int i=1; float s=0; while(s<=f) { i++; s+=1.0/i; } return i-1; } int main() { int j=0,i=0; float a[100]; while(1) { cin>>a[i]; if(a[i]==0.00) break; i++; } for(j=0;j<i;j++) cout<<number(a[j])<<" (cards)"<<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