結果
問題 | No.537 ユーザーID |
ユーザー |
![]() |
提出日時 | 2020-02-20 16:58:22 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 1,356 bytes |
コンパイル時間 | 1,821 ms |
コンパイル使用メモリ | 177,356 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-08 19:01:36 |
合計ジャッジ時間 | 2,786 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)#define all(x) (x).begin(), (x).end()#define sz(x) ((ll)(x).size())#define len(x) ((ll)(x).length())vector<pair<ll, ll>> factorize(ll n) {vector<pair<ll, ll>> res;for (ll i = 2; (i * i) <= n; i++) {if (n % i) continue;res.emplace_back(i, 0);while((n % i) == 0) {n /= i;res.back().second++;}}if (n != 1) res.emplace_back(n, 1);return res;}int main() {cin.tie(0);ios::sync_with_stdio(false);// ifstream in("input.txt");// cin.rdbuf(in.rdbuf());ll n;cin >> n;auto fac = factorize(n);set<ll> s;set<string> ans;s.insert(1);ans.insert(to_string(1) + to_string(n));rep(i, sz(fac)) {rep(j, fac[i].second) {set<ll> add;for(auto x : s) add.insert(x * fac[i].first);for(auto x : add) {s.insert(x);ans.insert(to_string(x) + to_string(n / x));}}}cout << sz(ans) << endl;return 0;}