//// main.cpp// eoj1852_struct//// Created by whyisyoung on 2/27/14.// Copyright (c) 2014 whyisyoung. All rights reserved.//#include <iostream>#include <cstdio>#include <algorithm>#include <cstdlib>usingnamespacestd;structfraction{intnumerator;intdenominator;}frac[7820];intgcd(inta,intb){return(b==0)?a:(gcd(b,a%b));}intgenerate_fractions(intn){intcount=0;for(inti=1;i<=n-1;i++){for(intj=i+1;j<=n;j++){if(gcd(i,j)==1){frac[count].numerator=i;frac[count++].denominator=j;}}}returncount;}intcompare(constvoid*a,constvoid*b){fraction*x=(fraction*)a;fraction*y=(fraction*)b;doublefrac_a=x->numerator*1.0/x->denominator;doublefrac_b=y->numerator*1.0/y->denominator;if(frac_a<frac_b)return-1;if(frac_a>frac_b)return1;return0;}intmain(intargc,charconst*argv[]){intn,count;while(scanf("%d",&n)!=EOF){count=generate_fractions(n);cout<<"0/1\n";qsort(frac,count,sizeof(frac[0]),compare);for(inti=0;i<count;i++)cout<<frac[i].numerator<<'/'<<frac[i].denominator<<endl;cout<<"1/1\n";}return0;}
//// main.cpp// eoj1852//// Created by whyisyoung on 2/23/14.// Copyright (c) 2014 whyisyoung. All rights reserved.//#include <iostream>#include <cstdio>#include <algorithm>#include <map>#include <cstdlib>#include <string>#include <cstring>usingnamespacestd;map<double,string>frac;intgcd(inta,intb){return(b==0)?a:(gcd(b,a%b));}intgenerate_fractions(intn){intsize=0;for(inti=1;i<=n-1;++i){for(intj=i+1;j<=n;j++){if(gcd(i,j)==1){charcstr[10];sprintf(cstr,"%d/%d",i,j);// itoa(i, cstr, 10) is deprecatedstringstr(cstr);frac[i*1.0/j]=str;size++;}}}returnsize;}intmain(intargc,charconst*argv[]){intn,size;while(cin>>n){size=generate_fractions(n);cout<<"0/1\n";map<double,string>::iteratorit=frac.begin();for(;it!=frac.end();it++){cout<<it->second<<endl;}cout<<"1/1\n";}return0;}