結果
問題 |
No.3299 K-th MMA String
|
ユーザー |
|
提出日時 | 2025-10-05 15:09:17 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 564 bytes |
コンパイル時間 | 2,922 ms |
コンパイル使用メモリ | 278,908 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-10-05 15:09:21 |
合計ジャッジ時間 | 3,986 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; int main(){ int n,k; cin>>n>>k; for(int i=1;i<=(1e9);i++){ for(int j=0;j<28;j++){ if((i>>j&1)==0&&(i>>(j+1)&1)==1&&(i>>(j+2)&1)==1){ k--; if(k==0){ string ans; for(int j=30;j>=0;j--){ if(ans.size()>0){ if(i>>j&1)ans+='M'; else ans+='A'; }else if(i>>j&1)ans+='M'; } reverse(ans.begin(),ans.end()); while(ans.size()<n)ans+='A'; reverse(ans.begin(),ans.end()); cout<<ans<<endl; return 0; } break; } } } }