結果
問題 | No.491 10^9+1と回文 |
ユーザー | ldsyb |
提出日時 | 2017-03-11 16:58:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 1,000 ms |
コード長 | 363 bytes |
コンパイル時間 | 690 ms |
コンパイル使用メモリ | 69,332 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-01 08:30:58 |
合計ジャッジ時間 | 3,843 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 103 |
ソースコード
#include <iostream> #include <algorithm> using namespace std; int main(){ long long n, ans = 0; cin >> n; n /= 1000000001; for(int i = 1; i < 1e5; i++){ string v = to_string(i); string s = v, t = v; reverse(v.begin(), v.end()); s += v; t += v.substr(1, v.size() - 1); if(stoll(s) <= n) ans++; if(stoll(t) <= n) ans++; } cout << ans << endl; }