結果

問題 No.2766 Delicious Multiply Spice
ユーザー Moss_Local
提出日時 2024-05-31 23:06:47
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 551 bytes
コンパイル時間 15,072 ms
コンパイル使用メモリ 399,616 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-21 01:27:25
合計ジャッジ時間 16,967 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6 WA * 2
other AC * 10 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::io;

fn main() {
    let mut input = String::new();
    io::stdin()
        .read_line(&mut input)
        .expect("Failed to read line");
    let mut n: u64 = input.trim().parse().expect("Not a number");

    let mut result = Vec::new();

    while n > 1 {
        if (n - 1) % 2 == 0 {
            result.push('A');
            n = (n - 1) / 2;
        } else {
            result.push('B');
            n = (n - 1) / 3;
        }
    }

    result.reverse();
    let result: String = result.iter().collect();
    println!("{}", result);
}
0