結果

問題 No.491 10^9+1と回文
ユーザー Nasatame
提出日時 2017-03-10 22:46:16
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 551 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 56,556 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-24 08:25:17
合計ジャッジ時間 2,785 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 WA * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

using ll = long long;



int main(void){
    // Here your code !
    ll n;
    cin >> n;
    
    //1 - 9 , 11 , 22 , 33 , 99 , 111
    
    ll tmp = 1;
    ll res = 0;
    
    while(true){
        for(int i = 1; i <= 9; i++){
            if( (n) >= tmp * i * 1000000001 ){
                //cout << tmp * i << endl;
                res++;
            }else{
                cout << res << endl;
                return 0;
            }
        }
        tmp = tmp * 10 + 1;
    }
    
}
0