結果
| 問題 | No.251 大きな桁の復習問題(1) | 
| コンテスト | |
| ユーザー |  fiord | 
| 提出日時 | 2015-07-25 00:04:50 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 551 bytes | 
| コンパイル時間 | 1,272 ms | 
| コンパイル使用メモリ | 160,200 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-16 02:07:46 | 
| 合計ジャッジ時間 | 1,977 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 WA * 2 | 
| other | AC * 7 WA * 14 | 
ソースコード
#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;
	if(nextn==0){
		if(nextm==0)	cout<<1<<endl;
		else cout<<0<<endl;
		return 0;
	}
	while(nextm>0){
		if(nextm%2&&rand()%3==0)	ans=(ans*nextn)%E;
		nextn=(nextn*nextn)%E;
		nextm/=2;
	}
	cout<<ans<<endl;
	return 0;
}
	
            
            
            
        