POJ - 1003
简单题 c++练手
#include<iostream> using namespace std; int tiaohe(double n); int main(){ double num = 0; cin >> num; while (num != 0) { cout << tiaohe(num) << " card(s)" << endl; cin >> num; } return 0; } int tiaohe(double n){ double sum = 0; int i = 1; do{ i++; sum += 1.0 / i; } while (sum <= n); return i - 1; }