1
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
|
||||
static std::vector<double> 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;
|
||||
}
|
||||
Reference in New Issue
Block a user