ap数
This commit is contained in:
parent
f306443f78
commit
7755423390
3
2757_num_apbit/Readme.md
Normal file
3
2757_num_apbit/Readme.md
Normal file
@ -0,0 +1,3 @@
|
||||
# 标题
|
||||
|
||||
* 内容
|
1
2757_num_apbit/doc/Readme.md
Normal file
1
2757_num_apbit/doc/Readme.md
Normal file
@ -0,0 +1 @@
|
||||
#
|
BIN
2757_num_apbit/doc/ap数(小数据量).pdf
Normal file
BIN
2757_num_apbit/doc/ap数(小数据量).pdf
Normal file
Binary file not shown.
33
2757_num_apbit/main.cpp
Normal file
33
2757_num_apbit/main.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
cin >> n;
|
||||
int a[1001] = { 0 };
|
||||
for (int i = 1; i <= n; i++) {
|
||||
int len = sqrt(i);
|
||||
for (int j = 1; j <= len; j++) {
|
||||
if (i / j == 0) {
|
||||
break;
|
||||
}
|
||||
if (i % j == 0) {
|
||||
a[i] += 2;
|
||||
if (j == i/j) {
|
||||
a[i]--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int ans = 0;
|
||||
for (int i = 1; i <= n; i++) {
|
||||
//cout << i << " " << a[i] << "\n";
|
||||
if (a[ans] < a[i]) {
|
||||
//cout << "\n";
|
||||
ans = i;
|
||||
}
|
||||
}
|
||||
cout << ans;
|
||||
}
|
BIN
2757_num_apbit/main.exe
Normal file
BIN
2757_num_apbit/main.exe
Normal file
Binary file not shown.
1
2757_num_apbit/test/in.txt
Normal file
1
2757_num_apbit/test/in.txt
Normal file
@ -0,0 +1 @@
|
||||
10
|
1
2757_num_apbit/test/in2.txt
Normal file
1
2757_num_apbit/test/in2.txt
Normal file
@ -0,0 +1 @@
|
||||
20
|
1
2757_num_apbit/test/in3.txt
Normal file
1
2757_num_apbit/test/in3.txt
Normal file
@ -0,0 +1 @@
|
||||
50
|
18
2757_num_apbit/test/out.txt
Normal file
18
2757_num_apbit/test/out.txt
Normal file
@ -0,0 +1,18 @@
|
||||
## z:\Chao\src\2757_num_apbit\test\in.txt
|
||||
2020/05/01 ÖÜÎå 19:19:47.36
|
||||
6
|
||||
-----------------------------------------------
|
||||
Process exited after 160 ms with return value 0
|
||||
|
||||
## z:\Chao\src\2757_num_apbit\test\in2.txt
|
||||
2020/05/01 ÖÜÎå 19:19:47.36
|
||||
12
|
||||
-----------------------------------------------
|
||||
Process exited after 100 ms with return value 0
|
||||
|
||||
## z:\Chao\src\2757_num_apbit\test\in3.txt
|
||||
2020/05/01 ÖÜÎå 19:19:47.36
|
||||
48
|
||||
-----------------------------------------------
|
||||
Process exited after 90 ms with return value 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user