結果

問題 No.491 10^9+1と回文
ユーザー matsukin1111
提出日時 2019-04-27 16:39:31
言語 C++14
(gcc 8.3.0)
結果
AC  
実行時間 36 ms
コード長 1,331 Byte
コンパイル時間 931 ms
使用メモリ 2,428 KB
最終ジャッジ日時 2019-10-12 17:24:32

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
sample_01.txt AC 26 ms
2,424 KB
sample_02.txt AC 28 ms
2,428 KB
sample_03.txt AC 27 ms
2,428 KB
system_test1.txt AC 27 ms
2,424 KB
system_test2.txt AC 28 ms
2,428 KB
system_test3.txt AC 27 ms
2,428 KB
test100.txt AC 27 ms
2,428 KB
test_01.txt AC 36 ms
2,428 KB
test_02.txt AC 25 ms
2,424 KB
test_03.txt AC 26 ms
2,424 KB
test_04.txt AC 27 ms
2,424 KB
test_05.txt AC 26 ms
2,428 KB
test_06.txt AC 25 ms
2,428 KB
test_07.txt AC 25 ms
2,428 KB
test_08.txt AC 27 ms
2,428 KB
test_09.txt AC 28 ms
2,424 KB
test_10.txt AC 27 ms
2,424 KB
test_11.txt AC 28 ms
2,428 KB
test_12.txt AC 26 ms
2,424 KB
test_13.txt AC 27 ms
2,428 KB
test_14.txt AC 25 ms
2,428 KB
test_15.txt AC 25 ms
2,424 KB
test_16.txt AC 26 ms
2,424 KB
test_17.txt AC 26 ms
2,424 KB
test_18.txt AC 26 ms
2,428 KB
test_19.txt AC 26 ms
2,428 KB
test_20.txt AC 25 ms
2,424 KB
test_21.txt AC 25 ms
2,428 KB
test_22.txt AC 24 ms
2,420 KB
test_23.txt AC 24 ms
2,428 KB
test_24.txt AC 25 ms
2,428 KB
test_25.txt AC 25 ms
2,424 KB
test_26.txt AC 25 ms
2,428 KB
test_27.txt AC 25 ms
2,424 KB
test_28.txt AC 25 ms
2,428 KB
test_29.txt AC 25 ms
2,424 KB
test_30.txt AC 25 ms
2,424 KB
test_31.txt AC 24 ms
2,424 KB
test_32.txt AC 25 ms
2,424 KB
test_33.txt AC 25 ms
2,424 KB
test_34.txt AC 25 ms
2,428 KB
test_35.txt AC 25 ms
2,428 KB
test_36.txt AC 25 ms
2,424 KB
test_37.txt AC 25 ms
2,428 KB
test_38.txt AC 25 ms
2,428 KB
test_39.txt AC 25 ms
2,428 KB
test_40.txt AC 25 ms
2,428 KB
test_41.txt AC 25 ms
2,424 KB
test_42.txt AC 25 ms
2,424 KB
test_43.txt AC 26 ms
2,428 KB
test_44.txt AC 26 ms
2,424 KB
test_45.txt AC 27 ms
2,424 KB
test_46.txt AC 27 ms
2,424 KB
test_47.txt AC 27 ms
2,424 KB
test_48.txt AC 26 ms
2,424 KB
test_49.txt AC 26 ms
2,424 KB
test_50.txt AC 26 ms
2,428 KB
test_51.txt AC 27 ms
2,428 KB
test_52.txt AC 26 ms
2,428 KB
test_53.txt AC 27 ms
2,428 KB
test_54.txt AC 26 ms
2,424 KB
test_55.txt AC 29 ms
2,424 KB
test_56.txt AC 28 ms
2,424 KB
test_57.txt AC 27 ms
2,428 KB
test_58.txt AC 26 ms
2,428 KB
test_59.txt AC 25 ms
2,428 KB
test_60.txt AC 25 ms
2,424 KB
test_61.txt AC 28 ms
2,428 KB
test_62.txt AC 28 ms
2,424 KB
test_63.txt AC 28 ms
2,428 KB
test_64.txt AC 25 ms
2,424 KB
test_65.txt AC 25 ms
2,424 KB
test_66.txt AC 24 ms
2,428 KB
test_67.txt AC 25 ms
2,428 KB
test_68.txt AC 25 ms
2,428 KB
test_69.txt AC 25 ms
2,428 KB
test_70.txt AC 24 ms
2,424 KB
test_71.txt AC 25 ms
2,424 KB
test_72.txt AC 24 ms
2,428 KB
test_73.txt AC 25 ms
2,424 KB
test_74.txt AC 24 ms
2,424 KB
test_75.txt AC 24 ms
2,424 KB
test_76.txt AC 25 ms
2,424 KB
test_77.txt AC 24 ms
2,428 KB
test_78.txt AC 25 ms
2,428 KB
test_79.txt AC 25 ms
2,424 KB
test_80.txt AC 25 ms
2,428 KB
test_81.txt AC 25 ms
2,428 KB
test_82.txt AC 25 ms
2,424 KB
test_83.txt AC 24 ms
2,428 KB
test_84.txt AC 25 ms
2,424 KB
test_85.txt AC 25 ms
2,428 KB
test_86.txt AC 25 ms
2,428 KB
test_87.txt AC 25 ms
2,424 KB
test_88.txt AC 28 ms
2,424 KB
test_89.txt AC 27 ms
2,428 KB
test_90.txt AC 27 ms
2,428 KB
test_91.txt AC 28 ms
2,424 KB
test_92.txt AC 26 ms
2,428 KB
test_93.txt AC 25 ms
2,424 KB
test_94.txt AC 25 ms
2,428 KB
test_95.txt AC 26 ms
2,424 KB
test_96.txt AC 25 ms
2,428 KB
test_97.txt AC 26 ms
2,428 KB
test_98.txt AC 26 ms
2,428 KB
test_99.txt AC 25 ms
2,428 KB
テストケース一括ダウンロード

ソースコード

diff #
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <cmath>   
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(int i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(int i = m;i >= n;--i)
#define INF INT_MAX/2
using namespace std;
using ll = long long;
using R = double;
using Data = pair<ll, vector<int>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 50;
struct edge { ll from; ll to; ll cost; };

vector<ll>s;

ll conv(string p) {
	ll ret = 0;
	reverse(all(p));
	ll dgt = 1;
	fore(x, p) {
		ret += dgt * (x - '0');
		dgt *= 10;
	}
	return ret;
}
ll getdigit(string s) {
	return s.size();
}

int main() {
	ll n;
	cin >> n;

	ll temp = 1e9 + 1;
	
	rep(i, 1, 10)s.pb(i);
	for(ll i = 1; i < 10000; i++) {
		string s1 = to_string(i);
		string s2 = s1;
		reverse(all(s2));
		s.pb(conv(s1 + s2));
		for (ll j = 0; j <= 9; j++) {
			s.pb(conv(s1 + to_string(j)+s2));
		}
	}
	sort(all(s));

	ll ans = 0;
	fore(x,s) {
		if (x * temp <= n)ans++;
	}
	cout << ans << endl;

	return 0;
}
0