結果
| 問題 | No.3299 K-th MMA String | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-08-22 03:07:33 | 
| 言語 | Rust (1.83.0 + proconio) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 546 bytes | 
| コンパイル時間 | 12,355 ms | 
| コンパイル使用メモリ | 398,060 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-08-22 03:07:47 | 
| 合計ジャッジ時間 | 13,019 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 | 
ソースコード
use proconio::input;
fn main() {
    input! {
        n: usize, mut k: usize,
    }
    for mut i in 6.. {
        let mut temp = i;
        while temp > 0 && temp % 8 != 6 {
            temp >>= 1;
        }
        if temp == 0 { continue; }
        k -= 1;
        if k == 0 {
            let mut ans = Vec::with_capacity(n);
            for _ in 0..n {
                ans.push(['A', 'M'][i & 1]);
                i >>= 1;
            }
            println!("{}", ans.iter().rev().collect::<String>());
            break;
        }
    }
}
            
            
            
        