blob: 15d5f551274d1844d7799a128cee7e5eec8c0068 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include <iostream>
#include <vector>
int main() {
long long n, a;
std::vector<long long> b = {0, 0, 6, 28, 96};
std::cin >> n;
for (long long k = 1; k <= n; k++) {
if (k <= 4) {
a = b[k];
} else {
// Both knights in new strip
a += (2*k - 1)*(k - 1) - 2;
// One knight in new strip, one in previous square
const long long s = (k-1)*(k-1);
a += 5*(s - 2);
a += 4*(s - 3);
a += (2*k - 10)*(s - 4);
}
std::cout << a << std::endl;
}
}
|