結果

問題 No.1611 Minimum Multiple with Double Divisors
ユーザー kwm_tkwm_t
提出日時 2021-07-21 23:59:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,741 bytes
コンパイル時間 1,532 ms
コンパイル使用メモリ 168,244 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-24 20:01:50
合計ジャッジ時間 17,889 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,868 ms
4,500 KB
testcase_01 AC 718 ms
4,376 KB
testcase_02 AC 848 ms
4,380 KB
testcase_03 AC 847 ms
4,376 KB
testcase_04 AC 846 ms
4,376 KB
testcase_05 AC 847 ms
4,376 KB
testcase_06 AC 846 ms
4,376 KB
testcase_07 AC 847 ms
4,376 KB
testcase_08 AC 846 ms
4,376 KB
testcase_09 AC 844 ms
4,380 KB
testcase_10 AC 266 ms
4,384 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
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 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:55:33: 警告: ‘idx’ may be used uninitialized [-Wmaybe-uninitialized]
   55 |                 rep2(i, 2, p[idx] + 1) {
      |                                 ^
main.cpp:47:27: 備考: ‘idx’ はここで定義されています
   47 |                 long long idx;
      |                           ^~~

ソースコード

diff #

#include "bits/stdc++.h"
//#include "atcoder/all"
using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
//const int mod = 1000000007;
//using mint = modint998244353;
//const int mod = 998244353;
//const int INF = 1e9;
//const long long LINF = 1e18;
//const bool debug = false;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i,l,r)for(int i=(l);i<(r);++i)
#define rrep(i, n) for (int i = (n-1); i >= 0; --i)
#define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i)
#define all(x) (x).begin(),(x).end()
#define allR(x) (x).rbegin(),(x).rend()
#define endl "\n"
#define P pair<int,int>
template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }
template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; }
//約数の個数
long long calc(long long n) {
	vector<long long> x;
	for (long long i = 2; i*i <= n; i++) {
		int c = 0;
		while (n%i == 0) { // 素数で割り切れなくなるまで割っていく
			c++;//割った個数を配列に足す
			n /= i;
		}
		if (0 != c) x.push_back(c);
		if (1 == n) break;
	}
	if (1 != n) x.push_back(1);

	long long nAns = 1;
	for (long long n = 0; n < x.size(); ++n) nAns *= x[n] + 1;
	return nAns;
}
vector<long long>p = { 2,3,5,7,11,13,17,19,23,29,31 };
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int t; cin >> t;
	while (t--) {
		long long x; cin >> x;
		long long idx;
		rep(i, p.size()) {
			if (0 != x % p[i]) {
				idx = i;
				break;
			}
		}
		long long xc = calc(x);
		rep2(i, 2, p[idx] + 1) {
			long long xy = calc(x*i);
			if (xy == xc * 2) {
				cout << x * i << endl;
				break;
			}
		}
	}
	return 0;
}
0