結果

問題 No.3264 岩井数
ユーザー Andrew8128
提出日時 2025-09-01 05:15:30
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 1,213 bytes
コンパイル時間 802 ms
コンパイル使用メモリ 98,528 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-01 05:15:36
合計ジャッジ時間 5,337 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other AC * 7 TLE * 1 -- * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using std::cerr, std::cin, std::cout, std::endl, std::fixed, std::flush;
#include <string>
using std::stoi, std::stol, std::string, std::to_string;
#include <algorithm>
using std::clamp, std::ranges::count, std::ranges::count_if, std::ranges::fill, std::ranges::find, std::ranges::find_if;
using std::ranges::is_permutation, std::ranges::lower_bound, std::ranges::max, std::ranges::max_element, std::ranges::min;
using std::ranges::min_element, std::ranges::next_permutation, std::ranges::prev_permutation, std::swap_ranges;
using std::ranges::reverse, std::ranges::rotate, std::ranges::sort, std::ranges::unique, std::ranges::upper_bound;
static_assert(sizeof(long) == 8);
#pragma GCC optimize("O3")
int main()
{
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long N;
  cin >> N;
  long M = N * (1000000000 / N + 1);
  long L = M / 10;
  while (1)
  {
    if (M % 10 != 9)
    {
      M += N;
      L = M / 10;
      continue;
    }
    string S = to_string(L);
    string T = S;
    reverse(T);
    if (S == T)
    {
      cout << L * 10 + 9 << '\n';
      return 0;
    }
    L += N;
  }
  return 0;
}
/*
  File : ~/kyopro/yukicoder/a.cpp
  Date : 2025/09/01
  Time : 05:10:33
*/
0