#include <iostream> using namespace std; constexpr unsigned int timerClockHz = 1'000'000; // Define constexpr computeReload here constexpr unsigned int computeReload(int clockHz, int intervalMs){ return (clockHz * intervalMs + 500) / 1000; } // Define constexpr RELOAD_TABLE here constexpr unsigned int RELOAD_TABLE[3] = { computeReload(timerClockHz, 1), computeReload(timerClockHz, 10), computeReload(timerClockHz, 100) }; 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