結果
| 問題 |
No.2864 String of yuusaan
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-30 22:02:18 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 558 bytes |
| コンパイル時間 | 2,047 ms |
| コンパイル使用メモリ | 194,220 KB |
| 最終ジャッジ日時 | 2025-02-24 03:03:40 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 14 WA * 5 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll siz[30];
int mss;
string key = "yuusaan";
char calc(int L, ll K) {
int ans = 0;
while (1) {
ll w = (ans % 6 ? 1ll : siz[L - 1]);
K -= w;
if (K <= 0) {
K += w;
break;
}
ans ++;
}
if (ans % 6) {
return key[ans];
} else {
return calc(L - 1, K);
}
}
int main () {
ll N, K;
cin >> N >> K;
siz[0] = 1;
mss = 1;
while (siz[mss - 1] < K) {
siz[mss] = siz[mss - 1] * 2 + 5;
mss ++;
}
N = min(N, (ll)mss - 1ll);
N = max(N, 1ll);
cout << calc(N, K) << endl;
}