結果
問題 | No.2186 冪乗の片側極限 |
ユーザー |
![]() |
提出日時 | 2023-01-13 21:41:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 528 bytes |
コンパイル時間 | 1,667 ms |
コンパイル使用メモリ | 191,844 KB |
最終ジャッジ日時 | 2025-02-10 02:20:15 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 53 WA * 3 |
コンパイルメッセージ
main.cpp:8:17: warning: overflow in conversion from ‘long long int’ to ‘int’ changes value from ‘1001002003004005006’ to ‘-1467868530’ [-Woverflow] 8 | const int mod = LINF; | ^~~~
ソースコード
#include <bits/stdc++.h> #define rep(i, a, n) for(int i = a; i < (n); i++) using namespace std; using ll = long long; using P = pair<int, int>; const int INF = 1001001001; const ll LINF = 1001002003004005006ll; const int mod = LINF; //const int mod = 998244353; // POWER_MODver. N^k % MOD ll mod_pow(ll n, ll k){ ll res = 1; for(; k > 0; k >>= 1){ if(k&1) res = (res*n)%mod; n = (n*n)%mod; } return res; } int main() { ll a, b; cin >> a >> b; cout << mod_pow(a, b) << endl; return 0; }