結果

問題 No.847 Divisors of Power
ユーザー tute7627
提出日時 2019-07-05 22:09:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 522 ms / 2,000 ms
コード長 1,718 bytes
コンパイル時間 1,638 ms
コンパイル使用メモリ 170,312 KB
実行使用メモリ 461,440 KB
最終ジャッジ日時 2024-10-06 21:51:35
合計ジャッジ時間 3,676 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

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