B:
分析: 这么简单递归居然想半天没有想到。。有一些细节问题容易wa
code:
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll f[505]; char s1[50]="QCOFFEE",s2[50]="QCHICKEN"; ll min(ll a,ll b){return a<b?a:b;} ll max(ll a,ll b){return a>b?a:b;} void solve(int now,ll k) { if(now==1) printf("%c",s1[k]); else if(now==2) printf("%c",s2[k]); else { if(k>f[now-2]) solve(now-1,k-f[now-2]); else solve(now-2,k); } } int main() { int t; scanf("%d",&t); f[1]=6,f[2]=7; for(int i=3;i<=500;i++) f[i]=min(f[i-1]+f[i-2],1e14); while(t--) { int n; ll k; scanf("%d%lld",&n,&k); for(ll i=k;i<min(f[n]+1,k+10);i++) solve(n,i); printf("\n"); } return 0; }