/*
ID: cm750621
PROB: frac1
LANG: C++
*/
#include <cstdio>
#include <cstdlib>
int i,j,k,m,n;
void sch(int a1,int a2,int b1,int b2){
if(a1+b1>n || a2+b2>n)
return;
else{
int m1=a1+b1,m2=a2+b2;
sch(a1,a2,m1,m2);
printf("%d/%d\n",a1+b1,a2+b2);
sch(m1,m2,b1,b2);
}
}
int main(){
freopen("frac1.in","r",stdin);
freopen("frac1.out","w",stdout);
scanf("%d",&n);
printf("0/1\n");
sch(0,1,1,1);
printf("1/1\n");
}
usaco 2.1.2 frac1
最新推荐文章于 2016-03-05 20:40:32 发布