結果

問題 No.847 Divisors of Power
ユーザー dnishdnish
提出日時 2019-07-07 19:44:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 1,948 ms
コンパイル使用メモリ 176,336 KB
実行使用メモリ 16,928 KB
最終ジャッジ日時 2024-04-16 09:07:20
合計ジャッジ時間 5,773 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include "bits/stdc++.h"

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;

ll N, K, M;
vector<ll> yakusu(ll n){
	vector<ll> ret;
	for(ll i=1; i*i<=n; i++){
		if(n%i != 0) continue;
		ret.push_back(i);
		if(i*i<n) ret.push_back(n/i);
	}
	sort(ret.begin(), ret.end());
	return ret;
}
int main(){
	cin >> N >> K >> M;
	vector<ll> yaku = yakusu(N);

	set<ll> st;
	for(auto y: yaku){
		if(y<=M) st.insert(y);
	}
	REP(k,1,K){
		set<ll> tmpst = st;
		for(auto num1: tmpst){
			for(auto num2: tmpst) {
				if (num1 * num2 <= M) st.insert(num1 * num2);
			}
		}
		if(tmpst.size() == st.size()) break;
	}
	p(st.size());
	return 0;
}
0