- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.cpp
More file actions
Latest commit
26 lines (24 loc) · 589 Bytes
/
Copy pathsample.cpp
File metadata and controls
26 lines (24 loc) · 589 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include<iostream>
#include<vector>
usingnamespacestd;
intmain() {
int K = 3;
for(longlong N = 1; N <= 100;N++) {
cout << N << " : ";
longlong left = N*N*N;
longlong right = 0;
bool r = true;
longlong i = N-1;
for(;i >= 2;i-=2) {
if(r) right += i*i*i + (i-1)*(i-1)*(i-1);
else left += i*i*i + (i-1)*(i-1)*(i-1);
r = !right;
}
if(i==1) {
if(r) right += 1;
else left += 1;
}
cout << abs(right-left) << endl;
}
return0;
}