結果

問題 No.1836 Max Matrix
ユーザー publfl2publfl2
提出日時 2022-02-11 21:48:58
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 32,552 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-10 01:54:33
合計ジャッジ時間 1,624 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 56 ms
4,380 KB
testcase_03 AC 58 ms
4,376 KB
testcase_04 AC 32 ms
4,376 KB
testcase_05 AC 47 ms
4,380 KB
testcase_06 AC 36 ms
4,380 KB
testcase_07 AC 55 ms
4,376 KB
testcase_08 AC 16 ms
4,380 KB
testcase_09 AC 54 ms
4,376 KB
testcase_10 AC 36 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 67 ms
4,380 KB
testcase_13 AC 25 ms
4,380 KB
testcase_14 AC 30 ms
4,380 KB
testcase_15 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#define MOD 998244353

long long int power(long long int a, long long int b)
{
	long long int ans = 1;
	long long int k = a;
	while(b)
	{
		if(b%2==1) ans*=k, ans%=MOD;
		k*=k, k%=MOD;
		b/=2;
	}
	return ans;
}
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	
	long long int ans = 0;
	for(int i=1;i<=c;i++)
	{
		long long int s = power(c-i+1,a)-power(c-i,a)+MOD;
		long long int t = power(c-i+1,b)-power(c-i,b)+MOD;
		s%=MOD, t%=MOD;
		ans += (s*t)%MOD;
		ans %= MOD;
	}
	printf("%lld",ans);
}
0