結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
//#include<atcoder/all>
//using namespace atcoder;
using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
constexpr ll MAX = 2000000000000000000;
constexpr ld PI = 3.14159265358979;
constexpr ll MOD = 0;//2024948111;
ld dotorad(ld K){return PI * K / 180.0;}
ld radtodo(ld K){return K * 180.0 / PI;}
mt19937 mt;
void randinit(){srand((unsigned)time(NULL));mt = mt19937(rand());}
int main(){
    ll a,n;
    cin >> a >> n;
    ll M = 1,p = 0;
    while(M < 10000000){
        p++;
        M *= a;
    }
    cout << M << endl;
    ll ans = 1;
    for(ll i = 0;i < min(100LL,n);i++){
        ans = (ans * a) % M;
    }
    cout << ans << endl;
}
0