結果
| 問題 |
No.1836 Max Matrix
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-11 23:46:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 555 bytes |
| コンパイル時間 | 1,489 ms |
| コンパイル使用メモリ | 167,360 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 22:17:42 |
| 合計ジャッジ時間 | 3,410 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 最小値
ll a=mpow(m-i,h)-mpow(m-i-1,h)+mod;
ll b=mpow(m-i,w)-mpow(m-i-1,w)+mod;
ans=(ans+a*b)%mod;
}
cout<<ans<<endl;
return 0;
}