結果

問題 No.847 Divisors of Power
ユーザー totori_nyaatotori_nyaa
提出日時 2019-07-17 18:44:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 1,173 bytes
コンパイル時間 1,887 ms
コンパイル使用メモリ 173,612 KB
実行使用メモリ 16,000 KB
最終ジャッジ日時 2024-04-16 09:35:05
合計ジャッジ時間 2,913 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 71 ms
13,568 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 3 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 21 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 85 ms
16,000 KB
testcase_25 AC 2 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,944 KB
testcase_29 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

//firstに素因数、secondに素因数が何個あるか
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}


signed main(){
    ios::sync_with_stdio(false);
	cin.tie(0);

   ll n,k,m;
   cin>>n>>k>>m;
   vector<pair<ll,ll>> v = prime_factorize(n);
   for(int i=0;i<v.size();i++){
       v[i].second *= k;
   }
   ll ans=0;
   set<ll> st;
   st.insert(1);
   for(int i=0;i<v.size();i++){
       set<ll> s2;
       s2.insert(1);
       for(auto j:st){
           ll now = j;
           ll cnt=0;
           s2.insert(j);
           while(cnt<v[i].second && now<=m){
               now *= v[i].first;
               if(now<=m){
                   s2.insert(now);
               }           
               cnt++;
           }
       }
       st=s2;
   }
   cout<<st.size()<<endl;


}
0