結果
問題 | No.491 10^9+1と回文 |
ユーザー |
|
提出日時 | 2020-11-04 06:20:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 697 bytes |
コンパイル時間 | 862 ms |
コンパイル使用メモリ | 97,120 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-22 09:41:16 |
合計ジャッジ時間 | 3,825 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 94 WA * 9 |
ソースコード
#include <iostream>#include <string>#include <algorithm>#include <iostream>#include <string>#include <algorithm>#include <vector>#include <iomanip>#include <cmath>#include <stdio.h>#include <queue>#include <deque>#include <cstdio>#include <set>#include <map>#include <bitset>#include <stack>#include <cctype>using namespace std;int main() {long long n;cin >> n;n /= 1000000001;int co = 0;for (int i = 1; i <= 50000; i++) {string s = to_string(i);string s1 = s;reverse(s1.begin(), s1.end());string s2 = s + s1;string s3 = s + s1.substr(1, s1.size() - 1);if (stoll(s2) <= n) {co++;}if (stoll(s3) <= n) {co++;}}cout << co << endl;}