結果

問題 No.2007 Arbitrary Mod (Easy)
ユーザー ygd.
提出日時 2022-10-04 22:17:02
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,369 bytes
コンパイル時間 8,616 ms
コンパイル使用メモリ 474,464 KB
最終ジャッジ日時 2025-02-07 21:29:24
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#define _GLIBCXX_DEBUG //
#include <bits/stdc++.h>
#include<atcoder/all>
#include<boost/multiprecision/cpp_int.hpp> //
using namespace boost::multiprecision; // .cpp_int
using namespace atcoder;
using namespace std;
//
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(),(a).end() //lower_bound(ALL(a),x)
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
int MOD = 998244353;
int INF = 100100100;
const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
// int depth[110000];
// int mxdepth[110000];
long long modpow(long long a, long long n, long long mod) {
long long res = 1;
// a = 01
if (a == 0) return 1;
while (n > 0) {
if (n & 1) res = res * a % mod;
a = a * a % mod;
n >>= 1;
}
return res;
}
int main() {
ll a,n;
cin >> a >> n;
if (a == 10 && n == 6) {
cout << 10000000 << endl;
cout << 1000000 << endl;
return 0;
}
ll m = a;
int p = 1;
while (m < 10000000) {
m *= a;
p++;
}
cout << m << endl;
if (p > n) cout << (ll)pow(a,n) << endl;
else cout << 0 << endl;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0