結果
問題 | No.491 10^9+1と回文 |
ユーザー |
![]() |
提出日時 | 2020-11-17 09:30:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 16 ms / 1,000 ms |
コード長 | 392 bytes |
コンパイル時間 | 700 ms |
コンパイル使用メモリ | 69,572 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-23 01:56:31 |
合計ジャッジ時間 | 4,574 ms |
ジャッジサーバーID (参考情報) |
judge3 / 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;}