結果
| 問題 |
No.1552 Simple Dice Game
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2021-06-18 21:37:07 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 833 ms / 2,500 ms |
| コード長 | 649 bytes |
| コンパイル時間 | 4,043 ms |
| コンパイル使用メモリ | 251,408 KB |
| 最終ジャッジ日時 | 2025-01-22 09:03:00 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001
int main(){
long long N,M;
cin>>N>>M;
mint ans = 0;
for(int i=1;i<=M;i++){
mint temp = mint(i).pow(N) * (1+i)/2;
temp -= mint(i-1).pow(N) * (i)/2;
temp *= N;
temp *= i;
//cout<<temp.val()<<endl;
ans += temp;
}
for(int i=1;i<=M;i++){
mint temp = mint(M+1-i).pow(N) * (M+i)/2;
temp -= mint(M+1-i-1).pow(N) * (M+i+1)/2;
temp *= N;
temp *= i;
ans -= temp;
}
cout<<ans.val()<<endl;
return 0;
}
沙耶花