結果

問題 No.491 10^9+1と回文
ユーザー ldsyb
提出日時 2017-03-10 23:31:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 400 bytes
コンパイル時間 646 ms
コンパイル使用メモリ 65,268 KB
実行使用メモリ 13,756 KB
最終ジャッジ日時 2024-06-24 08:52:21
合計ジャッジ時間 4,882 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 TLE * 2 -- * 99
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

bool kaibun(string s){
	for(int i = 0; i < s.size() / 2; i++) if(s[i] != s[s.size() - i - 1]) return false;
	return true;
}

int main(){
	long long n, ans = 0;
	cin >> n;
	if(n < 1e9 + 1){
		cout << 0 << endl;
		return 0;
	}
	for(long long i = 1; (1e9 + 1) * i <= n; i++){
		if(kaibun(to_string(((long long)(1e9) + 1) * i))) ans++;
	}
	cout << ans << endl;
}
0