結果

問題 No.491 10^9+1と回文
ユーザー deltdelt
提出日時 2019-03-03 19:11:59
言語 C++11
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 438 bytes
コンパイル時間 620 ms
コンパイル使用メモリ 62,384 KB
実行使用メモリ 13,880 KB
最終ジャッジ日時 2024-06-23 13:17:29
合計ジャッジ時間 4,941 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 TLE * 2 -- * 99
権限があれば一括ダウンロードができます

ソースコード

diff #

#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