結果
問題 |
No.491 10^9+1と回文
|
ユーザー |
![]() |
提出日時 | 2017-03-10 23:57:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 926 bytes |
コンパイル時間 | 2,063 ms |
コンパイル使用メモリ | 172,036 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-24 09:09:21 |
合計ジャッジ時間 | 6,378 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 11 WA * 92 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int i=0;i<(n);i++) #define rep2(i,a,b) for (int i=(a);i<(b);i++) #define rrep(i,n) for (int i=(n)-1;i>=0;i--) #define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--) #define all(a) (a).begin(),(a).end() const bool DEBUG = true; #define dump(a) if (DEBUG) cout << (a) << endl; typedef long long ll; typedef pair<int, int> P; ll N; void solve() { ll p = (ll)1e9 + 1; ll count = 0; cin >> N; rep2(n, 1, 10) { if (N >= n * p) { dump(n); count++; } } rep2(i, 1, (int)1e4) { string s1, s2; s1 = s2 = to_string(i); reverse(all(s2)); ll n = stoll(s1 + s2); if (N >= n * p) { dump(n); count++; } rep(i, 10) { ll n = stoll(s1 + to_string(i) + s2); if (N >= n * p) { dump(n); count++; } } } cout << count << endl; } int main() { solve(); return 0; }