結果
問題 | No.2113 Distance Sequence 1.5 |
ユーザー |
![]() |
提出日時 | 2022-11-23 14:53:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,221 bytes |
コンパイル時間 | 2,438 ms |
コンパイル使用メモリ | 209,868 KB |
最終ジャッジ日時 | 2025-02-08 23:25:28 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#pragma GCC optimize(3)#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef string str;typedef pair<ll,ll> pii;#define F first#define S second#define pb push_back#define pq priority_queue#define all(x) (x).begin(),(x).end()#define bug(x) cerr << (x) << ' '#define debug(x) cerr << #x << " = " << x << '\n'#define yn(x) cout << (x==1?"Yes\n":"No\n")#define PI 3.14159265358979323#define Ststone ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)const ll max_n=1e6+20,max_int=2147483647,mod1=1e9+7,mod2=998244353;bool online = 0;ll t,n,m,a,b,c,d,k,e;ll modpow(ll x,ll y){x = x%mod2;ll ret = 1;while(y){if(y&1){ret = (ret*x)%mod2;}x = (x*x)%mod2;y >>= 1;}return ret;}void solve(){cin >> n >> m >> k;ll cnt1 = modpow(min(k,m),2*n)%mod2;ll cnt2 = (modpow(min(k,m),2*n)-modpow(min(k,m)-1,2*n)+mod2)%mod2;ll ans = (cnt1+cnt2*(max(m-k,0ll)%mod2))%mod2;cout << ans << '\n';}int main(){if(online){#ifndef ONLINE_JUDGEfreopen("input.txt","r",stdin);freopen("output.txt","w",stdout);#else#endif}Ststone;solve();}/**/