結果

問題 No.1844 Divisors Sum Sum
ユーザー 👑 ygussanyygussany
提出日時 2022-02-18 21:59:13
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 547 ms / 3,000 ms
コード長 833 bytes
コンパイル時間 1,933 ms
コンパイル使用メモリ 30,668 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-11 19:06:08
合計ジャッジ時間 10,480 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 484 ms
4,384 KB
testcase_01 AC 547 ms
4,376 KB
testcase_02 AC 544 ms
4,380 KB
testcase_03 AC 546 ms
4,376 KB
testcase_04 AC 545 ms
4,380 KB
testcase_05 AC 545 ms
4,376 KB
testcase_06 AC 544 ms
4,380 KB
testcase_07 AC 544 ms
4,380 KB
testcase_08 AC 547 ms
4,380 KB
testcase_09 AC 546 ms
4,380 KB
testcase_10 AC 500 ms
4,380 KB
testcase_11 AC 105 ms
4,380 KB
testcase_12 AC 380 ms
4,380 KB
testcase_13 AC 53 ms
4,376 KB
testcase_14 AC 178 ms
4,384 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 0 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,384 KB
testcase_21 AC 0 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,384 KB
testcase_25 AC 0 ms
4,376 KB
testcase_26 AC 0 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 0 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 0 ms
4,376 KB
testcase_37 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

const int Mod = 1000000007;

long long div_mod(long long x, long long y, long long z)
{
	if (x % y == 0) return x / y;
	else return (div_mod((1 + x / y) * y - x, (z % y), y) * z + x) / y;
}

long long pow_mod(int n, long long k)
{
	long long N, ans = 1;
	for (N = n; k > 0; k >>= 1, N = N * N % Mod) if (k & 1) ans = ans * N % Mod;
	return ans;
}

int main()
{
	int i, L, P[200001], e[200001];
	scanf("%d", &L);
	for (i = 1; i <= L; i++) scanf("%d %d", &(P[i]), &(e[i]));
	
	long long ans = 1;
	for (i = 1; i <= L; i++) ans = ans * (((e[i] + 1) * div_mod(pow_mod(P[i], e[i] + 1) - 1, P[i] - 1, Mod) + div_mod(pow_mod(P[i], e[i]) - 1, pow_mod((P[i] - 1), 2), Mod) * P[i] % Mod + Mod - div_mod(e[i] * pow_mod(P[i], e[i] + 1) % Mod, P[i] - 1, Mod)) % Mod) % Mod;
	printf("%lld\n", ans);
	fflush(stdout);
	return 0;
}
0