結果

問題 No.207 世界のなんとか
ユーザー halship
提出日時 2017-06-19 12:38:45
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 471 bytes
コンパイル時間 13,125 ms
コンパイル使用メモリ 378,792 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-02 07:40:21
合計ジャッジ時間 13,071 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io;

fn is_ok(mut n: u32) -> bool {
    if n % 3 == 0 {
        return true;
    }

    while n > 0 {
        if n % 10 == 3 {
            return true;
        }
        n /= 10;
    }
    false
}

fn main() {
    let mut ab = String::new();
    io::stdin().read_line(&mut ab).unwrap();
    let ab: Vec<u32> = ab.trim().split(' ').map(|s| s.parse().unwrap()).collect();

    for i in (ab[0]..ab[1] + 1).filter(|&n| is_ok(n)) {
        println!("{}", i);
    }
}
0