| ||||||||||
| 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 | |||||||||
救命啊!!!!错在哪啊?眼都花了题1003
#include <iostream>
#include <vector>
using namespace std;
int separate(float c)
{
if (c <= 1.00)
return 1;
float j;
int count = 0;
j = 2;
while(c>0)
{
c -= float(1/j);
count++;
j++;
}
return count;
}
int main()
{
float c;
vector<float> fVec;
cin >> c;
while (c!=0.00)
{
fVec.push_back(separate(c));
cin >> c;
}
for (int i = 0; i < fVec.size(); i++)
cout << fVec[i] << " 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