結果
| 問題 |
No.3299 K-th MMA String
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-01 00:49:58 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 678 bytes |
| コンパイル時間 | 3,316 ms |
| コンパイル使用メモリ | 279,544 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-11-01 00:50:04 |
| 合計ジャッジ時間 | 4,763 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i <= (b); i ++)
using std::cin, std::cout, std::cerr;
using ll = long long;
int main() {
std::ios::sync_with_stdio(false);
int n, k; cin >> n >> k;
auto check = [](int x) {
while(x > 0) {
if(x % 8 == 0b110)
return true;
x /= 2;
}
return false;
};
int x = 0;
while(k > 0) {
x ++;
if(check(x)) k --;
}
std::string ans = "";
while(x > 0) {
ans = std::string() + ((x & 1) ? "M" : "A") + ans;
x /= 2;
}
ans = std::string(n - ans.size(), 'A') + ans;
cout << ans << '\n';
}