-
Notifications
You must be signed in to change notification settings - Fork 0
/
4681 - Visible Lattice.cpp
59 lines (51 loc) · 2.31 KB
/
4681 - Visible Lattice.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
47
48
49
50
51
52
53
54
55
56
57
58
59
/******************************************************************************
* ▄██████████▄ ▀█████████▄ ▀██████████▄ ▄████████████▄ ▄██████████▄ *
* ▀▀███ ███▀ ███ ███ ███ ▀██▄ ▀███▀ ▀███▀ █▀ ▄███▀ *
* ███ ███ ███ ██ ███ ███ ▄███▀ *
* ▄███▄▄▄██▀ ▄███▄▄▄██▀ ███ ██▀ ███ ███ ▄███▀ *
* ▀▀███▀▀▀██▄ ▀▀███▀▀▀██▄ ▄███▄▄▄▄▄██▀ ███ ███ ▄███▀ *
* ███ ███ ▀▀███▀▀▀▀▀██▄ ███ ███ ▄███▀ *
* ███ ███ ███ ███ ███ ▄███▄ ▄███▄ ▄███▀ ▄█ *
* ▄▄████▀ ▄█████████▀ ▄███ ███▄ ▀████████████▀ ▀██████████▀ *
* *
* *Don't limit your challenges, challenge your limits. *
******************************************************************************/
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int mu[N];
void Mobius(){
mu[1] = 1;
for(int i = 1; i < N; i++)
if(mu[i])
for(int j = i + i; j < N; j += i)
mu[j] -= mu[i];
}
int cube(int x){
return x * x * x;
}
int a[N];
void init(){
Mobius();
for(int i = 1; i < N; i++){
for(int k = 1; k <= i; k++){
a[i] += mu[k] * (cube(i/k + 1) - 1);
}
}
int T;
scanf("%d",&T);
for(int t=1; t<=T; t++){
int n;
scanf("%d",&n);
printf("%d\n",a[n]);
}
}
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
init();
return 0;
}