Skip to content

Commit b3247e5

Browse files
authored
Merge pull request #335 from arnavsingh010/Arnav
D-3 Q-2
2 parents 16fef17 + fe1d391 commit b3247e5

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name":"Local: solution2","url":"\\\\wsl.localhost\\Ubuntu\\home\\arnav\\cp\\CP-Chronicles\\Problems\\Mathematics\\Day-03\\solution\\Arnav_Singh\\solution2.cpp","tests":[{"id":1766936868396,"input":"","output":""}],"interactive":false,"memoryLimit":1024,"timeLimit":3000,"srcPath":"\\\\wsl.localhost\\Ubuntu\\home\\arnav\\cp\\CP-Chronicles\\Problems\\Mathematics\\Day-03\\solution\\Arnav_Singh\\solution2.cpp","group":"local","local":true}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int main() {
5+
long long a,b;
6+
cin >> a>>b;
7+
long long cnt=0;
8+
long long r=100;
9+
long long m= max(a,b);
10+
long long n=min(a,b);
11+
a=m;
12+
b=n;
13+
while(r!=0){
14+
long long q=a/b;
15+
r=a-(b*q);
16+
a=r;
17+
long long m=max(a,b);
18+
long long n=min(a,b);
19+
a=m;
20+
b=n;
21+
cnt+=q;
22+
}
23+
cout<<cnt;
24+
return 0;
25+
}
26+
//time complexity O(log(min(a,b)))
27+
//https://codeforces.com/contest/343/submission/355576599
102 KB
Binary file not shown.

0 commit comments

Comments
 (0)