Two Knights | CSES Solution
- Time limit: 1.00 s
- Memory limit: 512 MB
Input
The only input line contains an integer .
Output
Print integers: the results.
Constraints
Input:
8
Output:
0
6
28
96
252
550
1056
1848
void solve() {
int n;cin>>n;for(int i=1; i<=n; i++){ int total=(i*i)*((i*i) -1)/2; int attack=4*(i-1)*(i-2); cout<<total-attack<<endl;}
}
0 Comments
If you have any doubts/suggestion/any query or want to improve this article, you can comment down below and let me know. Will reply to you soon.