結果
| 問題 |
No.2864 String of yuusaan
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-30 21:28:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 499 bytes |
| コンパイル時間 | 668 ms |
| コンパイル使用メモリ | 64,256 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-26 14:33:43 |
| 合計ジャッジ時間 | 1,258 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
#include<iostream>
#include<cassert>
using namespace std;
long len[50];
void dfs(int n,long k)
{
assert(len[n]>k);
if(n==1)
{
cout<<"yuusaan"[k]<<endl;
return;
}
if(len[n-1]>k)dfs(n-1,k);
else
{
k-=len[n-1];
if(k<5)cout<<"uusaa"[k]<<endl;
else
{
k-=5;
dfs(n-1,k);
}
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
long N,K;
cin>>N>>K;
len[1]=7;
for(int i=2;i<50;i++)
{
len[i]=len[i-1]*2+5;
}
N=min(N,49L);
K--;
assert(len[N]>K);
dfs(N,K);
}