PRINTF - Editorial

PROBLEM LINK:

Practice

Contest

Author: Akash Choudhary

Tester: Chinmay Rasshit

Editorialist: Chinmay Rakshit

DIFFICULTY:

CAKEWALK, SIMPLE.

PREREQUISITES:

MATH

PROBLEM:

Given a two numbers h (HCF) and n (number of integers whose HCF is h and whose sum is minimum)

conditions :

  • Si > H , ∀ 0 ≤ i < N.

  • Si ≤ Si+1, ∀ 0 ≤ i < N-1

QUICK EXPLANATION:

first of all find two(x,y) number which is greater than h and have HCF h and these two number should be minimum now print the min(x,y) n-1 times and max(x,y) at last this is the required output.

AUTHOR’S AND TESTER’S SOLUTIONS:

Author’s solution can be found here.

Tester’s solution can be found here.

//