POJ 1003 Hangover
POJ 1003 Hangover 水题
//POJ 1003 #include <iostream> using namespace std; float l[1001]; int main() { float f; l[0] = 0; for (int i = 1; i <= 1000; i++) l[i] = l[i-1]+1.0/(i+1); while (cin>>f, f!=0.00) { for (int i = 1; i <= 1000; i++) if (l[i] > f) { cout << i << " card(s)" << endl; break; } } // system("pause"); return 0; }