結果
問題 |
No.491 10^9+1と回文
|
ユーザー |
![]() |
提出日時 | 2017-03-10 22:37:21 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 431 bytes |
コンパイル時間 | 1,218 ms |
コンパイル使用メモリ | 160,492 KB |
実行使用メモリ | 13,760 KB |
最終ジャッジ日時 | 2024-06-24 07:57:33 |
合計ジャッジ時間 | 5,659 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 TLE * 2 -- * 99 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define int long long bool check(int a){ string s = to_string(a); int len = s.length(); bool ok = true; for(int i = 0; i < (len / 2) - 1; i++){ if(s[i] != s[len - 1 - i]){ ok = false; break; } } return ok; } signed main(){ int a = 1e9 + 1; int n; cin >> n; int count = 0; for(int i = a; i < n; i += a){ if(check(i)){ count++; } } cout << count << endl; }