0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:11:58 +00:00

869. 试除法求约数

https://www.acwing.com/problem/content/submission/code_detail/7745986/
This commit is contained in:
Baoshuo Ren 2021-09-15 21:46:55 +08:00 committed by Baoshuo Ren
parent 6937a91b97
commit 9adc6d8bb7
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

24
AcWing/869/869.cpp Normal file
View File

@ -0,0 +1,24 @@
#include <bits/stdc++.h>
using namespace std;
int n, a;
int main() {
cin >> n;
while (n--) {
set<int> ans;
cin >> a;
for (int i = 1; i * i <= a; i++) {
if (a % i == 0) {
ans.insert(i);
ans.insert(a / i);
}
}
for (int i : ans) {
cout << i << ' ';
}
cout << endl;
}
return 0;
}