結果

問題 No.491 10^9+1と回文
コンテスト
ユーザー delt
提出日時 2019-03-03 19:11:59
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 438 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 572 ms
コンパイル使用メモリ 79,964 KB
実行使用メモリ 16,328 KB
最終ジャッジ日時 2026-03-08 08:38:55
合計ジャッジ時間 26,570 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 92 TLE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int f(long long n){
  string s = to_string(n);
  int l = 0;
  int r = s.length() - 1;
  while(l < r){
    if(s[l] != s[r]) return 0;
    l++;
    r--;
  }
  return 1;
}

int main(void){
  long long n;
  cin >> n;
  int ans = 0;
  long long b = 1e+9 + 1;
  int c = n / b;
  for(int i = 1; i <= c; i++) ans += f(b * i);
  cout << ans << endl;
  return 0;  
}
0