#include #include static std::vector max_lengths; static void init() { double length = 0; for (int i = 2; length < 5.5; i++) { max_lengths.push_back(length); length += 1.0 / i; } } int main() { init(); double target_length = 0; for (;;) { std::cin >> target_length; if (target_length == 0) { break; } for (int i = 0;; i++) { if (max_lengths[i] > target_length) { std::cout << i << " card(s)" << std::endl; break; } } } return 0; }