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:
parent
6937a91b97
commit
9adc6d8bb7
24
AcWing/869/869.cpp
Normal file
24
AcWing/869/869.cpp
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user