mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-08 14:18:47 +00:00
201. 可见的点
https://www.acwing.com/problem/content/submission/code_detail/13342989/
This commit is contained in:
parent
d351581fbf
commit
a804001bc5
35
AcWing/201/201.cpp
Normal file
35
AcWing/201/201.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include <iostream>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
const int N = 1005;
|
||||
|
||||
int _t, n, phi[N], ans;
|
||||
|
||||
int main() {
|
||||
// Init
|
||||
for (int i = 2; i <= 1000; i++) {
|
||||
phi[i] = i;
|
||||
}
|
||||
for (int i = 2; i <= 1000; i++) {
|
||||
if (phi[i] == i) {
|
||||
for (int j = i; j <= 1000; j += i) {
|
||||
phi[j] = phi[j] / i * (i - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
// End: Init
|
||||
|
||||
cin >> _t;
|
||||
for (int t = 1; t <= _t; t++) {
|
||||
ans = 0;
|
||||
cin >> n;
|
||||
for (int i = 2; i <= n; i++) {
|
||||
ans += phi[i];
|
||||
}
|
||||
cout << t << ' ' << n << ' ' << ans * 2 + 3 << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user