結果

問題 No.1164 GCD Products hard
ユーザー furafura
提出日時 2020-08-14 03:11:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 560 bytes
コンパイル時間 2,476 ms
コンパイル使用メモリ 194,708 KB
実行使用メモリ 42,840 KB
最終ジャッジ日時 2024-04-18 06:56:22
合計ジャッジ時間 39,049 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,350 ms
30,464 KB
testcase_01 AC 1,877 ms
34,632 KB
testcase_02 AC 1,263 ms
25,856 KB
testcase_03 AC 368 ms
11,392 KB
testcase_04 AC 368 ms
11,904 KB
testcase_05 AC 1,538 ms
30,208 KB
testcase_06 AC 2,022 ms
36,044 KB
testcase_07 AC 2,029 ms
38,216 KB
testcase_08 AC 1,866 ms
39,236 KB
testcase_09 AC 1,176 ms
27,008 KB
testcase_10 AC 364 ms
10,496 KB
testcase_11 AC 1,349 ms
28,416 KB
testcase_12 AC 1,996 ms
35,656 KB
testcase_13 AC 1,024 ms
22,784 KB
testcase_14 AC 949 ms
26,752 KB
testcase_15 AC 2,025 ms
39,240 KB
testcase_16 AC 1,150 ms
28,544 KB
testcase_17 AC 1,559 ms
29,440 KB
testcase_18 AC 1,271 ms
27,136 KB
testcase_19 AC 402 ms
12,288 KB
testcase_20 AC 667 ms
16,256 KB
testcase_21 AC 2,303 ms
38,852 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2,102 ms
42,840 KB
testcase_24 TLE -
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

const int MOD=1e9+7;

lint modpow(lint a,lint k,int m){
	lint r=1;
	for(lint x=a%m;k>0;k>>=1,x=x*x%m) if(k&1) r=r*x%m;
	return r;
}

int main(){
	int a,b,n; scanf("%d%d%d",&a,&b,&n);

	static int f[10000001];
	for(int g=b;g>=2;g--){
		f[g]=modpow(b/g-(a-1)/g,n,MOD-1);
		for(int h=2*g;h<=b;h+=g){
			f[g]-=f[h];
			if(f[g]<0) f[g]+=MOD-1;
		}
	}

	int ans=1;
	for(int g=2;g<=b;g++) ans=ans*modpow(g,f[g],MOD)%MOD;
	printf("%d\n",ans);

	return 0;
}
0