输出排名第k的法雷级数的值;
#include<cstdio> #include<cstring> using namespace std; int k,n; void dfs(int a,int b,int c,int d) { if(k<0)return; int x=a+c; int y=b+d; if(y>n)return ; dfs(a,b,x,y); --k; if(k==0){printf("%d/%d\n",x,y);k--;return;} dfs(x,y,c,d); } int main() { int t; scanf("%d",&t); while(t--) { scanf("%d",&n); scanf("%d",&k); dfs(0,1,1,1); } return 0; }