結果

問題 No.491 10^9+1と回文
ユーザー tkmst201tkmst201
提出日時 2017-03-11 14:17:19
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,670 bytes
コンパイル時間 813 ms
コンパイル使用メモリ 88,464 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-06 17:37:54
合計ジャッジ時間 17,716 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
4,380 KB
testcase_01 AC 125 ms
4,380 KB
testcase_02 AC 124 ms
4,384 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 125 ms
4,380 KB
testcase_09 AC 125 ms
4,380 KB
testcase_10 AC 124 ms
4,376 KB
testcase_11 AC 125 ms
4,376 KB
testcase_12 WA -
testcase_13 AC 126 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 123 ms
4,376 KB
testcase_17 AC 125 ms
4,408 KB
testcase_18 AC 126 ms
4,376 KB
testcase_19 WA -
testcase_20 AC 127 ms
4,380 KB
testcase_21 WA -
testcase_22 AC 125 ms
4,376 KB
testcase_23 WA -
testcase_24 AC 126 ms
4,376 KB
testcase_25 AC 124 ms
4,376 KB
testcase_26 AC 126 ms
4,380 KB
testcase_27 AC 125 ms
4,380 KB
testcase_28 AC 125 ms
4,376 KB
testcase_29 AC 124 ms
4,376 KB
testcase_30 WA -
testcase_31 AC 124 ms
4,380 KB
testcase_32 WA -
testcase_33 AC 128 ms
4,380 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 124 ms
4,380 KB
testcase_37 AC 128 ms
4,380 KB
testcase_38 AC 125 ms
4,376 KB
testcase_39 WA -
testcase_40 AC 125 ms
4,376 KB
testcase_41 WA -
testcase_42 AC 125 ms
4,380 KB
testcase_43 AC 128 ms
4,376 KB
testcase_44 AC 125 ms
4,376 KB
testcase_45 AC 125 ms
4,380 KB
testcase_46 WA -
testcase_47 AC 124 ms
4,380 KB
testcase_48 AC 124 ms
4,380 KB
testcase_49 AC 125 ms
4,380 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 126 ms
4,376 KB
testcase_53 AC 124 ms
4,380 KB
testcase_54 AC 125 ms
4,376 KB
testcase_55 AC 125 ms
4,376 KB
testcase_56 AC 126 ms
4,380 KB
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 AC 125 ms
4,376 KB
testcase_61 AC 125 ms
4,376 KB
testcase_62 WA -
testcase_63 WA -
testcase_64 AC 125 ms
4,380 KB
testcase_65 AC 138 ms
4,404 KB
testcase_66 AC 125 ms
4,380 KB
testcase_67 WA -
testcase_68 AC 124 ms
4,376 KB
testcase_69 AC 125 ms
4,412 KB
testcase_70 AC 125 ms
4,376 KB
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 AC 124 ms
4,384 KB
testcase_75 AC 124 ms
4,376 KB
testcase_76 AC 123 ms
4,380 KB
testcase_77 AC 124 ms
4,380 KB
testcase_78 WA -
testcase_79 WA -
testcase_80 AC 126 ms
4,380 KB
testcase_81 AC 123 ms
4,376 KB
testcase_82 AC 123 ms
4,380 KB
testcase_83 WA -
testcase_84 AC 125 ms
4,380 KB
testcase_85 WA -
testcase_86 AC 126 ms
4,376 KB
testcase_87 AC 124 ms
4,380 KB
testcase_88 AC 125 ms
4,376 KB
testcase_89 WA -
testcase_90 WA -
testcase_91 WA -
testcase_92 AC 125 ms
4,376 KB
testcase_93 WA -
testcase_94 WA -
testcase_95 AC 125 ms
4,404 KB
testcase_96 AC 125 ms
4,380 KB
testcase_97 WA -
testcase_98 WA -
testcase_99 WA -
testcase_100 WA -
testcase_101 WA -
testcase_102 WA -
testcase_103 WA -
testcase_104 WA -
testcase_105 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <complex>
#include <cctype>
#include <cassert>
#include <sstream>
#include <ctime>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;

#define INF (1<<29)
#define INFL (1ll<<60)
#define EPS (1e-8)
#define PI (acos(-1))
const ll MOD = 1000000007ll;

string to_str(ll x) {
	stringstream ss;
	ss << x;
	return ss.str();
}

ll to_ll(string str) {
	stringstream ss(str);
	ll res;
	ss >> res;
	
	return res;
}

bool ispd(string str) {
	REP(i, str.size() / 2) if (str[i] != str[str.size() - 1 - i])
		return false;
	return true;
}

int main() {
	ll N;
	cin >> N;
	
	ll n = N / 1000000001;
	
	vector<ll> v;
	for (ll i = 1; i <= 110000; i++) {
		string now = to_str(i);
		
		string rev = now;
		reverse(ALL(rev));
		
		string tmp = now.substr(0, now.size() - 1) + rev;
		if (ispd(tmp)) v.push_back(to_ll(tmp));
		
		
		if (!ispd(now)) continue;
		
		tmp = now + rev;
		v.push_back(to_ll(tmp));
	}
	
	sort(ALL(v));
	v.erase(unique(ALL(v)), v.end());
	
	int ans = 0;
	REP(i, v.size()) {
		if (v[i] <= n) ans++;
	}
	cout << ans << endl;
	
	return 0;
}
0