結果
| 問題 | No.2864 String of yuusaan | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-08-30 22:03:17 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 534 bytes | 
| コンパイル時間 | 1,994 ms | 
| コンパイル使用メモリ | 194,068 KB | 
| 最終ジャッジ日時 | 2025-02-24 03:04:31 | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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);
	cout << calc(N, K) << endl;
}
            
            
            
        