vector<int> get_divisors(int x) { vector<int> res; for (int i = 1; i <= x / i; i ++ ) if (x % i == 0) { res.push_back(i); if (i != x / i) res.push_back(x / i); } sort(res.begin(), res.end()); return res; }
intmain() { int n; cin >> n;
while (n -- ) { int x; cin >> x; auto res = get_divisors(x);
for (auto x : res) cout << x << ' '; cout << endl; }
#include<bits/stdc++.h> usingnamespace std; #define ll long long const ll N = 1000000007; intmain(){ map<int, int>record; // 记录每一个零件的个数 int n; cin >> n; while (n--) { int val; cin >> val; for (int i = 2; i <= val / i; i++) { while (val % i == 0) { val /= i; record[i]++; } // 将此零件放入 } // 判断最后是否是一个质数 if (val != 1) { record[val]++; } } ll res = 1; map<int, int>::iterator i = record.begin(); for (i = record.begin(); i != record.end(); i++) { res = ((i->second + 1) * (res)) % N; } cout<<res<<endl; }
for (int i = 2; i <= x / i; i ++ ) while (x % i == 0) { x /= i; primes[i] ++ ; }
if (x > 1) primes[x] ++ ; }
LL res = 1; for (auto p : primes) { LL a = p.first, b = p.second; LL t = 1; // 这里相当于把之前的和全都右移一位加上一个 a^0 while (b -- ) t = (t * a + 1) % mod; res = res * t % mod; }