結果

問題 No.491 10^9+1と回文
ユーザー tonyu0
提出日時 2020-04-05 14:50:05
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 13,794 ms
コンパイル使用メモリ 378,604 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-03 08:11:50
合計ジャッジ時間 15,404 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 42 WA * 61
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: u64 = itr.next().unwrap().parse().unwrap();
    let mut q: std::collections::VecDeque<u64> = (1..10).collect();

    let mut ans = 0;
    while let Some(x) = q.pop_front() {
        if x * 1000000001 > n {
            println!("{}", ans);
            return;
        }
        ans += 1;
        q.push_back(x * 10 + x);
    }
}
0