結果

問題 No.1552 Simple Dice Game
ユーザー kotatsugamekotatsugame
提出日時 2021-06-18 22:37:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 430 ms / 2,500 ms
コード長 419 bytes
コンパイル時間 729 ms
コンパイル使用メモリ 68,660 KB
実行使用メモリ 8,596 KB
最終ジャッジ日時 2023-09-04 23:47:54
合計ジャッジ時間 6,882 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
8,472 KB
testcase_01 AC 4 ms
8,532 KB
testcase_02 AC 4 ms
8,472 KB
testcase_03 AC 421 ms
8,532 KB
testcase_04 AC 4 ms
8,468 KB
testcase_05 AC 5 ms
8,468 KB
testcase_06 AC 4 ms
8,476 KB
testcase_07 AC 5 ms
8,596 KB
testcase_08 AC 4 ms
8,532 KB
testcase_09 AC 335 ms
8,512 KB
testcase_10 AC 386 ms
8,460 KB
testcase_11 AC 393 ms
8,468 KB
testcase_12 AC 115 ms
8,552 KB
testcase_13 AC 330 ms
8,476 KB
testcase_14 AC 194 ms
8,532 KB
testcase_15 AC 246 ms
8,504 KB
testcase_16 AC 37 ms
8,520 KB
testcase_17 AC 57 ms
8,516 KB
testcase_18 AC 304 ms
8,464 KB
testcase_19 AC 426 ms
8,508 KB
testcase_20 AC 428 ms
8,468 KB
testcase_21 AC 430 ms
8,520 KB
testcase_22 AC 429 ms
8,476 KB
testcase_23 AC 429 ms
8,532 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
long N;
int M;
mint L[5<<17],R[5<<17];
main()
{
	cin>>N>>M;
	L[0]=0;
	mint ans=0,pre=0;
	for(int i=1;i<=M;i++)
	{
		L[i]=mint(i).pow(N)*N*(i+1)/2;
		mint tmp=L[i];
		L[i]-=pre;
		pre=tmp;
		ans+=i*L[i];
	}
	for(int i=1;i<=M;i++)
	{
		int j=M-i+1;
		ans-=mint(j).pow(N)*N*(M-mint(j-1)/2);
	}
	cout<<ans.val()<<endl;
}
0