maoxiantongxue's blog

By maoxiantongxue, history, 3 months ago, In English

It it an easy problem. We just need to write the "gcd" function first. Here is the code. ~~~~~

include

using namespace std; int gcd(int x, int y){ if(x%y==0) return y; else return gcd(y,x%y); } int main(){ int Y,W,D,big,small,a; cin>>Y>>W; if(Y-W>0){ big=Y; small=W; } else{ big=W; small=Y; } D=6-big+1; a=gcd(D,6); D=D/a; cout<<D<<"/"<<6/a<<endl; return 0; } ~~~~~

 
 
 
 
  • Vote: I like it
  • -18
  • Vote: I do not like it

»
3 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Just in case you don't know how Codeforces works, there is an editorial for each contest where all problem solutions are explained.