結果
問題 |
No.3264 岩井数
|
ユーザー |
![]() |
提出日時 | 2025-09-06 14:41:40 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 773 bytes |
コンパイル時間 | 3,842 ms |
コンパイル使用メモリ | 283,924 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-09-06 14:42:18 |
合計ジャッジ時間 | 34,324 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 TLE * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #ifdef LOCAL #include <debug.hpp> #else #define debug(...) #endif ll naive(ll N) { // 1e17 以下の iwi 数を全探索 string pre, suf, s1, s2; for (ll i = 1e4;; i++) { pre = to_string(i); suf = pre; reverse(suf.begin(), suf.end()); s1 = pre + suf + '9'; s2 = pre + suf.substr(1) + '9'; ll n1 = stoll(s1), n2 = stoll(s2); if (n1 > 1e15 && n2 > 1e15) break; if (n1 % N == 0) return n1; if (n2 % N == 0) return n2; } assert(false); return 0; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); ll N; cin >> N; cout << naive(N) << '\n'; }