結果

問題 No.491 10^9+1と回文
ユーザー rogi52rogi52
提出日時 2022-10-12 23:06:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 452 bytes
コンパイル時間 1,963 ms
コンパイル使用メモリ 194,056 KB
最終ジャッジ日時 2025-02-08 02:17:06
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 WA * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll N; cin >> N;
    ll ans = 0;
    constexpr ll X = 1e9+1;
    for(int d = 1; d <= 9; d++) {
        for(int k = 1; k <= 10; k++) {
            ll Y = stoll(string(k, char(d + '0'))) * X;
            if(1 <= Y && Y <= N) ans++;
        }
    }
    cout << ans << endl;
}
0