結果

問題 No.2766 Delicious Multiply Spice
ユーザー
提出日時 2024-08-07 13:38:18
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 13,478 ms
コンパイル使用メモリ 386,780 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-08-07 13:38:34
合計ジャッジ時間 15,867 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 8
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

fn r(n: u64) -> Option<String> {
	if n < 1 {
		return Some("".to_owned());
	}
	if n % 3 < 1 {
		if let Some(s) = r(n / 3 - 1) {
			return Some(s + "B");
		}
	}
	if n % 2 < 1 {
		if let Some(s) = r(n / 2 - 1) {
			return Some(s + "A");
		}
	}
	None
}
fn main() {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	let n: u64 = s.trim().parse().unwrap();
	println!("{}", r(n - 1).unwrap_or("".to_owned()))
}
0