結果
| 問題 |
No.677 10^Nの約数
|
| コンテスト | |
| ユーザー |
kyo1
|
| 提出日時 | 2020-07-26 15:18:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,017 bytes |
| コンパイル時間 | 5,022 ms |
| コンパイル使用メモリ | 199,204 KB |
| 最終ジャッジ日時 | 2025-01-12 05:59:59 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
template <typename T>
int pow(int x, T n, int mod = std::numeric_limits<int>::max()) {
int res = 1;
while (n > 0) {
if (n & 1) res = static_cast<int64_t>(res) * static_cast<int64_t>(x) % mod;
x = static_cast<int64_t>(x) * static_cast<int64_t>(x) % mod;
n >>= 1;
}
return res;
}
template <typename T>
int64_t pow(int64_t x, T n, int64_t mod = std::numeric_limits<int64_t>::max()) {
int64_t res = 1;
while (n > 0) {
if (n & 1) res = static_cast<__int128>(res) * static_cast<__int128>(x) % mod;
x = static_cast<__int128>(x) * static_cast<__int128>(x) % mod;
n >>= 1;
}
return res;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int N;
cin >> N;
vector<int64_t> res;
for (int i = 0; i < N + 1; i++) {
for (int j = 0; j < N + 1; j++) {
res.emplace_back(pow(INT64_C(2), i) * pow(INT64_C(5), j));
}
}
sort(res.begin(), res.end());
for (auto r : res) {
cout << r << '\n';
}
return 0;
}
kyo1