結果
問題 |
No.491 10^9+1と回文
|
ユーザー |
|
提出日時 | 2024-03-04 17:15:14 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,488 bytes |
コンパイル時間 | 2,120 ms |
コンパイル使用メモリ | 195,268 KB |
最終ジャッジ日時 | 2025-02-20 00:46:39 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 WA * 71 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep1(i, n) for (ll i = 1; i < (n); ++i) #define rrep(i, n) for (ll i = n; i > 0; --i) #define bitrep(i, n) for (ll i = 0; i < (1 << n); ++i) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define yesNo(b) ((b) ? "Yes" : "No") using ll = long long; using ull = unsigned long long; using ld = long double; string alphabet = "abcdefghijklmnopqrstuvwxyz"; string ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const double pi = 3.141592653589793; int smallMOD = 998244353; int bigMOD = 1000000007; int main() { ll x; cin >> x; if (x < 1e9) { cout << 0 << endl; } else if (x < 1e10) { int ans = x / 1e9; if (x % 1000000000ll < ans) { ans--; } cout << ans << endl; } else if (x < 1e11) { int ans = 9 + x / 1e10; if (x % 10000000000ll < ans) { ans--; } cout << ans << endl; } else if (x < 1e12) { int ans = 18 + x / 1e11; if (x % 100000000000ll < ans) { ans--; } cout << ans << endl; } else if (x < 1e13) { int ans = 27 + x / 1e12; if (x % 1000000000000ll < ans) { ans--; } cout << ans << endl; } else if (x < 1e14) { int ans = 36 + x / 1e13; if (x % 10000000000000ll < ans) { ans--; } cout << ans << endl; } else if (x < 1e15) { int ans = 45 + x / 1e14; if (x % 100000000000000ll < ans) { ans--; } cout << ans << endl; } else if (x < 1e16) { int ans = 54 + x / 1e15; if (x % 1000000000000000ll < ans) { ans--; } cout << ans << endl; } else if (x < 1e17) { int ans = 63 + x / 1e16; if (x % 10000000000000000ll < ans) { ans--; } cout << ans << endl; } else if (x < 1e18) { int ans = 72 + x / 1e17; if (x % 100000000000000000ll < ans) { ans--; } cout << ans << endl; } else if (x < 1e19) { int ans = 81 + x / 1e18; if (x % 1000000000000000000ll < ans) { ans--; } cout << ans << endl; } return 0; }