結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー nekoenvy
提出日時 2022-07-15 21:48:36
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 469 bytes
コンパイル時間 4,592 ms
コンパイル使用メモリ 163,396 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 17:27:33
合計ジャッジ時間 7,161 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

// cum is the only solution

#include <bits/stdc++.h>
#ifndef LOCAL
#define debug(...) 0
#else
#include "../template/debug.cpp"
#endif

using namespace std;
using ll = int_fast64_t;
const int MOD = 1e9 + 7;

ll pow(ll a, ll b, ll m){
	ll res = 1;
	while(b){
		if(b & 1) res = (res * a) % m;
		a = (a * a) % m;
		b /= 2;
	}
	return res;
}

int main(){
	cin.tie(0) -> sync_with_stdio(0);
	ll a,b; cin >> a >> b;
	cout << MOD << endl;
	cout << pow(a, b, MOD) << endl;
	
}
0