Can someone explain this?

Codeforces
Solution:
int n, v[] = {2, 7, 2, 3, 3, 4, 2, 5, 1, 2};
cin >> n;
cout << v[n / 10] * v[n % 10];

How exactly the guy coded this.

The array is some hard-coded voodoo that represents the answer for each individual digit - the number of possible digits such that some sticks could be broken to show that digit. The main idea there is that the two digits are independent, so the total answer would be the answer for the first digit multiplied by the second digit.

1 Like