結果
| 問題 | No.2766 Delicious Multiply Spice |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-31 21:33:16 |
| 言語 | Rust (1.99.0 + proconio + num + itertools + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 615 bytes |
| 記録 | |
| コンパイル時間 | 12,942 ms |
| コンパイル使用メモリ | 189,984 KB |
| 実行使用メモリ | 9,896 KB |
| 最終ジャッジ日時 | 2026-10-05 08:28:21 |
| 合計ジャッジ時間 | 20,543 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 8 |
| other | AC * 24 TLE * 1 -- * 6 |
ソースコード
use proconio::input;
// #[proconio::fastout]
fn main() {
input! {
n: usize,
}
let mut result = Vec::new();
rec(n, 1, &mut result);
let text: String = result.into_iter().rev().collect();
println!("{}", text);
}
fn rec(n: usize, x: usize, result: &mut Vec<char>) -> bool {
// println!("x {}", x);
if x > n {
return false;
}
if n == x {
return true;
}
if rec(n, x * 2 + 1, result) {
result.push('A');
return true;
}
if rec(n, x * 3 + 1, result) {
result.push('B');
return true;
}
false
}