結果

問題 No.491 10^9+1と回文
コンテスト
ユーザー kimiyuki
提出日時 2017-03-10 22:45:10
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 842 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 527 ms
コンパイル使用メモリ 106,080 KB
実行使用メモリ 16,192 KB
最終ジャッジ日時 2026-03-10 08:34:21
合計ジャッジ時間 213,256 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 90 TLE * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
#include <set>
#include <map>
#include <queue>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <cassert>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
#define repeat_from(i,m,n) for (int i = (m); (i) < int(n); ++(i))
#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
using ll = long long;
using namespace std;
string str(int n) {
    ostringstream oss;
    oss << n;
    return oss.str();
}
int main() {
    ll n; cin >> n;
    int k = n / 1000000001;
    int cnt = 0;
    repeat_from (i, 1, k+1) {
        string s = str(i);
        string t = s; whole(reverse, t);
        if (s == t) ++ cnt;
    }
    cout << cnt << endl;
    return 0;
}
0