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