結果
| 問題 | No.3299 K-th MMA String | 
| コンテスト | |
| ユーザー |  くらげ | 
| 提出日時 | 2025-08-20 22:59:08 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 589 bytes | 
| コンパイル時間 | 1,790 ms | 
| コンパイル使用メモリ | 195,516 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-08-20 22:59:11 | 
| 合計ジャッジ時間 | 3,166 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 20 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
bool judge(int x){
    while(x){
        if(x%8==6) return true;
        x/=2;
    }
    return false;
}
int main(){
    int n,k;
    cin >> n >> k;
    rep(i,1<<20) if(judge(i)){
        k--;
        if(k==0){
            string ans;
            while(i){
                ans+="AM"[i&1];
                i/=2;
            }
            while(ans.size()<n) ans+='A';
            reverse(ans.begin(),ans.end());
            cout << ans << endl;
            return 0;
        }
    }
}
            
            
            
        