結果
| 問題 | No.2864 String of yuusaan |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2024-09-18 22:17:52 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 574 bytes |
| 記録 | |
| コンパイル時間 | 971 ms |
| コンパイル使用メモリ | 213,652 KB |
| 実行使用メモリ | 16,768 KB |
| 最終ジャッジ日時 | 2026-07-05 17:38:11 |
| 合計ジャッジ時間 | 2,276 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}
vjudge1