結果

問題 No.847 Divisors of Power
ユーザー 👑 tute7627tute7627
提出日時 2019-07-05 22:09:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 622 ms / 2,000 ms
コード長 1,718 bytes
コンパイル時間 1,915 ms
コンパイル使用メモリ 170,092 KB
実行使用メモリ 461,440 KB
最終ジャッジ日時 2024-04-16 07:26:13
合計ジャッジ時間 3,874 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 12 ms
6,016 KB
testcase_07 AC 18 ms
8,576 KB
testcase_08 AC 23 ms
9,728 KB
testcase_09 AC 43 ms
27,264 KB
testcase_10 AC 8 ms
7,936 KB
testcase_11 AC 64 ms
54,664 KB
testcase_12 AC 19 ms
12,288 KB
testcase_13 AC 59 ms
48,768 KB
testcase_14 AC 4 ms
5,504 KB
testcase_15 AC 19 ms
15,816 KB
testcase_16 AC 20 ms
9,216 KB
testcase_17 AC 51 ms
33,536 KB
testcase_18 AC 236 ms
213,632 KB
testcase_19 AC 622 ms
461,440 KB
testcase_20 AC 7 ms
5,376 KB
testcase_21 AC 7 ms
6,784 KB
testcase_22 AC 9 ms
5,420 KB
testcase_23 AC 14 ms
6,784 KB
testcase_24 AC 11 ms
10,864 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 13 ms
6,784 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
#define test cout<<"test"<<endl;
#define fi first
#define se second
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
const ll zero=0;
using P = pair<ll, ll>;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  bool judge = true;
  ll n,k,m;cin>>n>>k>>m;
  buf=n;
  map<ll,ll>p;
  for(i=2;buf!=1&&i*i<=n;i++){
    for(j=0;buf%i==0;j++){
      buf/=i;
    }
    if(i>0)p.emplace(i,k*j);
    //cout<<buf<<endl;
  }
  if(buf!=1)p.emplace(buf,k);
  vector<vector<ll>>q(p.size()+1);
  q[0].push_back(1);
  j=1;
  for(auto z:p){
    //cout<<q[j-1].size()<<endl;
    //cout<<z.fi spa z.se<<endl;
    for(auto zz:q[j-1]){
      buf=zz;
      for(i=0;i<=z.se;i++){
        if(buf<=m)q[j].push_back(buf);
        else break;
        buf*=z.fi;
      }
    }
    j++;
  }
  cout<<q.back().size()<<endl;



  return 0;
}
0