結果

問題 No.491 10^9+1と回文
ユーザー fiord
提出日時 2017-03-10 23:48:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 932 bytes
コンパイル時間 663 ms
コンパイル使用メモリ 69,356 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-24 09:05:39
合計ジャッジ時間 2,929 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 WA * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main() {
	ll n;	cin >> n;
	ll list[] = { 1,
				11,
				101,111,
				1001,1111,
				10001,10101,11011,11111,
				100001,101101,110011,111111,
				1000001,1001001,1010101,1011101,1100011,1101011,1110111,1111111,
				10000001,10011001,10100101,10111101,11000011,11011011,11100111,11111111,
				100000001,100010001,100101001,100111001,101000101,101010101,101101101,101111101,110000011,110010011,110101011,110111011,111000111,111010111,111101111,111111111,
				1000000001,1000110001,1001001001,1001111001,1010000101,1010110101,1011001101,1011111101,1100000011,1100110011,1101001011,1101111011,1110000111,1110110111,1111001111,1111111111
	};
	ll cnt = 0;
	ll num = 1;
	ll base = 1e9 + 1;
	ll multi = 0;
	while (n >= num*list[multi]*base) {
		cnt++;
		num++;
		if (num == 10) {
			num = 1;
			multi++;
		}
	}
	cout << cnt << endl;
}
0