結果

問題 No.1666 累乗数
ユーザー tailstails
提出日時 2021-09-03 23:12:44
言語 cLay
(20231016-1)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 404 bytes
コンパイル時間 8,203 ms
コンパイル使用メモリ 215,412 KB
実行使用メモリ 11,148 KB
最終ジャッジ日時 2023-09-19 02:38:32
合計ジャッジ時間 12,277 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
10,912 KB
testcase_01 AC 185 ms
10,968 KB
testcase_02 AC 187 ms
10,816 KB
testcase_03 AC 184 ms
10,824 KB
testcase_04 AC 185 ms
11,148 KB
testcase_05 AC 185 ms
10,872 KB
testcase_06 AC 185 ms
10,968 KB
testcase_07 AC 185 ms
11,016 KB
testcase_08 AC 185 ms
11,032 KB
testcase_09 AC 185 ms
10,924 KB
testcase_10 AC 184 ms
10,852 KB
testcase_11 AC 185 ms
10,904 KB
testcase_12 AC 185 ms
10,920 KB
testcase_13 AC 185 ms
10,852 KB
testcase_14 AC 185 ms
10,844 KB
testcase_15 AC 184 ms
11,016 KB
testcase_16 AC 184 ms
10,908 KB
testcase_17 AC 185 ms
10,908 KB
testcase_18 AC 185 ms
10,924 KB
testcase_19 AC 185 ms
11,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

int moe[64];

ll g(ll p,ll m){
	ll x=pow(m,1./p);
	while((__int128_t)x**p>m){
		--x;
	}
	while((__int128_t)(x+1)**p<=m){
		++x;
	}
	return x-1;
}

ll f(ll k){
	ll lo=0,hi=1d18;
	while(lo+1<hi){
		ll m=lo+hi>>1;
		ll c=1;
		rep(p,2,64){
			c+=g(p,m)*moe[p];
		}
		if(c<k){
			lo=m;
		}else{
			hi=m;
		}
	}
	return hi;
}

{
	rep(i,2,64){
		moe[i]=-Moebius(i);
	}

	ll@t;
	rep(t){
		ll@k;
		wt(f(k));
	}
}
0