結果
| 問題 |
No.1836 Max Matrix
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-12 00:15:13 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 598 bytes |
| コンパイル時間 | 2,164 ms |
| コンパイル使用メモリ | 192,652 KB |
| 最終ジャッジ日時 | 2025-01-27 22:27:54 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 2 WA * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
const ll mod=998244353;//≒10⁹ 素数
int mpow(int x,int y){//mod付きx^y
//x^(a+b+c)=x^a × x^b × x^cを利用
bitset<32> btst(y);
ll ans=1;
for(int i=0;i<32;i++){
if(btst.test(i)){
ans=(ans*x)%mod;
}
x=(x*x)%mod;
}
return ans;
}
int main(){
ll h,w,m,ans=0;
cin>>h>>w>>m;
for(int i=0;i<m;i++){//i=最小値-1
ll a=(mpow(m-i,h)-mpow(m-i-1,h)+mod)%mod;
ll b=(mpow(m-i,w)-mpow(m-i-1,w)+mod)%mod;
//cout<<a<<' '<<b<<endl;
ans=(ans+a*b)%mod;
}
cout<<ans<<endl;
return 0;
}