MHGOC04 -Editorial

Question

GCD Exploration

Difficulty level

Easy

Prerequisites

None

Code

include < bits/stdc++.h >

using namespace std;

typedef long long LL;

LL gcd(LL a, LL b)
{

LL r;

while (b)

{

r = a % b;

a = b;

b = r;
}

return a;

}

int main()

{
LL N, a, b;

scanf("%lld%lld%lld", &N, &a, &b);

LL g = gcd(a, b);

for (int i = 0; i < g; i++)

printf("%lld", N);

printf("\n");

return 0;
}