This commit is contained in:
2026-07-24 09:24:21 +08:00
parent 209d7e2bb3
commit 536a697566
23 changed files with 684 additions and 62 deletions
+30
View File
@@ -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;
}