結果
問題 |
No.491 10^9+1と回文
|
ユーザー |
![]() |
提出日時 | 2020-11-17 09:30:27 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 1,000 ms |
コード長 | 394 bytes |
コンパイル時間 | 938 ms |
コンパイル使用メモリ | 70,312 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-23 01:56:26 |
合計ジャッジ時間 | 4,564 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 103 |
ソースコード
#include <iostream> #include <string> #include <algorithm> using namespace std; int main(){ long long N; cin >> N; N /= 1000000001; int ans = 0; for (int i = 1; i < 100000; i++){ string S = to_string(i); string T = S; reverse(T.begin(), T.end()); string T2 = T.substr(1); if (stoll(S + T) <= N){ ans++; } if (stoll(S + T2) <= N){ ans++; } } cout << ans << endl; }