結果
| 問題 |
No.251 大きな桁の復習問題(1)
|
| コンテスト | |
| ユーザー |
maine_honzuki
|
| 提出日時 | 2021-05-04 16:51:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 548 bytes |
| コンパイル時間 | 6,107 ms |
| コンパイル使用メモリ | 401,588 KB |
| 最終ジャッジ日時 | 2025-01-21 06:42:40 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 WA * 1 |
ソースコード
//https://ncode.syosetu.com/n4830bu/251/
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
using namespace std;
using ll = long long;
const ll mod = 129402307;
int main() {
cpp_int N, M;
cin >> N >> M;
N %= mod;
M %= (mod - 1);
cpp_int ans = 1;
if (N == 0 && M == 0)
ans = 0;
while (M) {
if (M % 2 == 1) {
ans *= N;
ans %= mod;
}
N *= N;
N %= mod;
M /= 2;
}
cout << ans << endl;
}
maine_honzuki