-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2725.cpp
More file actions
61 lines (50 loc) ยท 1003 Bytes
/
2725.cpp
File metadata and controls
61 lines (50 loc) ยท 1003 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
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
60
61
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define endl "\n"
#define MAX 1e9
struct coordinate {
int x;
int y;
};
struct Customer {
int x;
int y;
int Dest_x;
int Dest_y;
};
int dx[] = {-1, 0, 0, 1, 1, -1, -1, 1};
int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
//int dx[] = {0, -1, -1, 0, 1, 1, 1, 0, -1};
//int dy[] = {0,0, -1, -1, -1, 0, 1, 1, 1};
//int dx[] = {-2, -2, -1, -1, 1, 1, 2, 2};
//int dy[] = {-1, 1, -2, 2, -2, 2, -1, 1};
int C, N;
int dp[1001];
void solve() {
dp[1] = 3;
for(int i = 2; i <= 1000; i++) {
int cnt = 0;
for(int j = 1; j < i; j++) {
if(gcd(i, j) == 1) {
cnt++;
}
}
dp[i] = dp[i-1] + cnt * 2;
}
}
void input() {
cin >> C;
solve();
while(C--) {
cin >> N;
cout << dp[N] << endl;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
input();
solve();
}