結果
| 問題 |
No.2864 String of yuusaan
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-09-18 22:17:37 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 746 bytes |
| コンパイル時間 | 1,820 ms |
| コンパイル使用メモリ | 192,984 KB |
| 最終ジャッジ日時 | 2025-02-24 09:23:52 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll n, k, len[60];
string s = " yuusaan";
void Print(int x, ll y) {
if (x == 1) cout << s[y];
else if (y <= len[x - 1]) Print(x - 1, y);
else if (y <= len[x - 1] + 5) cout << s[y - len[x - 1] + 1];
else Print(x - 1, y - len[x - 1] - 5);
}
int main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> n >> k, len[0] = 1;
for (int i = 1; i < 60; i++) {
len[i] = len[i - 1] * 2 + 5;
if (len[i] >= k) {
Print(i, k); break;
}
}
return 0;
}
/*
yuusaan
yuusaanuusaayuusaan
yuusaanuusaayuusaanuusaayuusaanuusaayuusaan
yuusaanuusaayuusaanuusaayuusaanuusaayuusaanuusaayuusaanuusaayuusaanuusaayuusaanuusaayuusaan
*/
vjudge1