Official
A - 急増する細菌 / Rapidly Multiplying Bacteria Editorial by admin Editorial for printing
swe-2-highOn day \(i\), the number of bacteria is \(A \times 2^{i-1}\). The program keeps the current count in a variable, prints it, then doubles it to produce the next day’s count, repeating this \(N\) times. Since tomorrow’s count is exactly twice today’s, this directly simulates the definition. The largest value is at most \(A \times 2^{29} \approx 5 \times 10^{17}\), which fits in a 64-bit integer (long long). The loop runs \(N\) iterations, so the time complexity is \(O(N)\), and only the current count is stored, so the space complexity is \(O(1)\).
posted:
last update: