結果
| 問題 |
No.491 10^9+1と回文
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-04 06:21:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 1,000 ms |
| コード長 | 698 bytes |
| コンパイル時間 | 854 ms |
| コンパイル使用メモリ | 95,384 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-22 09:41:59 |
| 合計ジャッジ時間 | 5,177 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 103 |
ソースコード
#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 <= 100000; 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;
}