結果
問題 |
No.491 10^9+1と回文
|
ユーザー |
![]() |
提出日時 | 2017-03-11 16:56:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 360 bytes |
コンパイル時間 | 731 ms |
コンパイル使用メモリ | 69,820 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-24 12:32:09 |
合計ジャッジ時間 | 4,712 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 100 WA * 3 |
ソースコード
#include <iostream> #include <algorithm> using namespace std; int main(){ long long n, ans = 0; cin >> n; n /= 1e9 + 1; 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; }