#include <iostream> using namespace std; // Define constexpr computeReload here constexpr int computeReload(int clockHz, int intervalMs) { return (clockHz * intervalMs + 500) / 1000; // integer rounding } // Define constexpr RELOAD_TABLE here constexpr int timerClockHz = 1'000'000; // 1 MHz constexpr int RELOAD_TABLE[3] = { computeReload(timerClockHz, 1), // 1 ms computeReload(timerClockHz, 10), // 10 ms computeReload(timerClockHz, 100) // 100 ms }; int main() { int idx; cin >> idx; // Print RELOAD_TABLE[idx] cout << RELOAD_TABLE[idx]; return 0; }
Test Cases
Test Results
Input
0
Expected Output
1000