One day Vasya is sitting on a not so interesting Maths lesson and making an origami from a rectangular a mm x B mm sheet of paper (a > b). Usually the first step in making an origami was making a square piece of paper from the rectangular sheet by folding the sh Along the bisector of the right angle, and cutting the excess part.
After making a paper ship from the square piece, Vasya looked on the remaining (a - b) mm x b mm strip of paper. He got the idea-to-use this strip of paper in the same-to-make an origami, and then use the remainder (if it exists) a nd so on. At the moment when he's left with a square piece of paper, he'll make the last ship from it and stop.
Can determine how many ships Vasya would make during the lesson?
Input
The first line of the input contains integers a, b (1≤ b < a ≤10)-the sizes of the original sheet of paper.
Output
Print a single integer-the number of ships that Vasya would make.
Sample Test (s) input
2 1
Output
2
Input
10 7
Output
6
Input
1000000000000 1
Output
1000000000000
Note
Pictures to the first and second sample test.
Note: Notice long long to use LLD output, but CF can not use cout, with D results in the back has been 0-0-good supernatural
typedef long long ll; convenient
#include <cstdio>#include<algorithm>#include<iostream>using namespaceStd;typedefLong Longll;intMain () {ll A, B; LL Flag=0; CIN>> a >>b; if(A >b); Else{ll temp=A; A=b; b=temp; } while(a%b) {Flag+ =/b; ll temp=b; b= A-(A/b) *b; A=temp; } Flag+ =/b; cout<<Flag;}
View Code
Codeforces Round #296 (Div. 2)--a long long--playing with Paper