結果
問題 | No.2766 Delicious Multiply Spice |
ユーザー |
|
提出日時 | 2024-08-07 13:38:40 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 410 bytes |
コンパイル時間 | 11,258 ms |
コンパイル使用メモリ | 387,844 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-08-07 13:38:56 |
合計ジャッジ時間 | 12,479 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 8 |
other | AC * 31 |
ソースコード
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())}