/* ID: zhangzz4 PROG: frac1 LANG: C++ */ #include<stdio.h> #include<stdlib.h> const int N=161; int v[N][N]; struct Frac { int d1,d2; double f; }f[N*N]; int n; int gcd(int a,int b){return b?gcd(b,a%b):a;} int cmp(const void *a,const void *b) { Frac *p1=(Frac *)a; Frac *p2=(Frac *)b; return p1->f>p2->f?1:-1; } int main() { freopen("frac1.in","r",stdin); freopen("frac1.out","w",stdout); scanf("%d",&n); int cnt=0; for(int i=1;i<=n;i++) for(int j=1;j<=i;j++) if(!v[j/gcd(j,i)][i/gcd(j,i)]) { f[cnt].d1=j/gcd(j,i); f[cnt].d2=i/gcd(j,i); f[cnt].f=j*1.0/i; v[f[cnt].d1][f[cnt].d2]=1; cnt++; } qsort(f,cnt,sizeof(f[0]),cmp); puts("0/1"); for(int i=0;i<cnt;i++) printf("%d/%d/n",f[i].d1,f[i].d2); scanf("%'d"); }