結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー shojin
提出日時 2024-05-04 18:34:47
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 294 bytes
コンパイル時間 3,656 ms
コンパイル使用メモリ 271,960 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-26 08:16:15
合計ジャッジ時間 6,849 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

long M = 1e7;

long pow(long x, long n){
  long ret = 1;
  while(n > 0){
    if(n & 1) ret = ret * x % M;
    x = x * x % M;
    n >>= 1;
  }
  return ret;
}

int main(){
  long a, n;
  cin >> a >> n;
  
  cout << M << endl;
  cout << pow(a, n);
}
0