| ||||||||||
| 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;
float cards[280];
int main()
{
cards[0]=0;
for(int i=1;i<280;i++){
cards[i]=cards[i-1]+1/float(i+1);
}
float c;
cin>>c ;
while(c!=0){
int k=1;
for(;k<280;k++){
if(cards[k]>=c)
break;
}
cout<<k<<" cards(s)"<<endl;
cin>>c;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator