結果
| 問題 |
No.251 大きな桁の復習問題(1)
|
| コンテスト | |
| ユーザー |
fiord
|
| 提出日時 | 2015-07-24 23:17:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 456 bytes |
| コンパイル時間 | 1,164 ms |
| コンパイル使用メモリ | 159,056 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-08 13:45:04 |
| 合計ジャッジ時間 | 1,822 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define E 129402307
int main(){
string n,m; cin>>n>>m;
ll nextn=0;
for(int i=0;i<(int)n.size();i++){
nextn=nextn*10+(ll)(n[i]-'0');
nextn%=E;
}
ll nextm=0;
for(int i=0;i<(int)m.size();i++){
nextm=nextm*10+(ll)(m[i]-'0');
nextm%=E-1;
}
ll ans=1;
while(nextm>0){
if(nextm%2) ans=(ans*nextn)%E;
nextn=(nextn*nextn)%E;
nextm/=2;
}
cout<<ans<<endl;
return 0;
}
fiord