#include <iostream> using namespace std; // Create constexpr lookup table here: struct table{ int data[6]; }; constexpr table lookup_table(){ table t = {}; int temp = -40; for (int i = 0; i < 5; i++) { t.data[i] = temp; temp += 30; } t.data[5] = 120; return t; } constexpr table crc_table = lookup_table(); int main() { int idx; cin >> idx; // Print the value from TEMP_TABLE based on idx cout << crc_table.data[idx]; return 0; }
Test Cases
Test Results
Expected Output
-40