結果
| 問題 | No.2864 String of yuusaan | 
| コンテスト | |
| ユーザー |  nonon | 
| 提出日時 | 2024-08-30 21:35:11 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 570 bytes | 
| コンパイル時間 | 1,954 ms | 
| コンパイル使用メモリ | 195,716 KB | 
| 最終ジャッジ日時 | 2025-02-24 02:54:16 | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 15 WA * 4 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    vector<long>sz={1};
    long add=6;
    while(sz.size()<50)
    {
        long nxt=sz.back()+add;
        sz.push_back(nxt);
        add*=2;
    }
    auto dfs=[&](auto dfs, long n, long k)->char
    {
        if(n==0)return "yuusaan"[k];
        if(k<sz[n-1])return dfs(dfs,n-1,k);
        if(k<sz[n-1]+5)return "uusaa"[k-sz[n-1]];
        return dfs(dfs,n-1,k-sz[n-1]-5);
    };
    long N,K;
    cin>>N>>K;
    cout<<dfs(dfs,min(N,50L),K-1)<<endl;
}
            
            
            
        