-
Notifications
You must be signed in to change notification settings - Fork 2
/
10177.cpp
46 lines (40 loc) · 790 Bytes
/
10177.cpp
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include<stdio.h>
#include<math.h>
#define MAXN 101
long long Store[3][MAXN];
long long RStore[3][MAXN];
void Gen_Sq() {
int i, j, k = 1;
long long Sum;
for(i = 0; i<3; i++){
Sum = 0;
k++;
for(j = 1; j<=100; j++) {
Sum += pow(j,k);
Store[i][j] = Sum;
}
}
}
void Gen_Rec() {
int i, j, k;
int p, q, n = 1;
for(i = 0; i<3; i++){
n++;
for(j = 2; j<= 100; j++) {
k = j - 1;
p = k+1; q = k+2;
if(p % 2 ==0) p /= 2;
else q /= 2;
RStore[i][j] = pow((p * q),n) - Store[i][j];
}
}
}
int main() {
int n;
Gen_Sq();
Gen_Rec();
while(scanf("%d",&n) == 1) {
printf("%lld %lld %lld %lld %lld %lld\n",Store[0][n],RStore[0][n],Store[1][n],RStore[1][n],Store[2][n],RStore[2][n]);
}
return 0;
}