CCFY-Editorial

PROBLEM LINK:

CONTEST

PRACTICE

Author: Medha Pandey

Tester: Akansha Bigasia

Editorialist:Sanya Tayal

DIFFICULTY:

MEDIUM-HARD

PREREQUISITES:

GCD, Number Theory

PROBLEM

For the display of chocolate in each packet, we need to devise a method to arrange chocolates in rows(x), such that x=gcd(stock number, no. of chocolates for that packet).

QUICK EXPLANATION:

Given an integer N find the GCD for calculating rows to arrange chocolates in N number of stocks having a particular number of chocolates arranged in x number of rows.

EXPLANATION:

In this question there will be n different stocks. The number of packets in each stock is such that Stock1 contains N packets, Stock2 contains N-1, Stock3 contains N-2 and so on up to last Stock which contains 1 packet. Here, the number of chocolate in each packet is 1+the packet number.

The number of rows of chocolates in each packet is the GCD of its stock number and number of chocolates in that packet.

Now we have to calculate the total number of rows of chocolates in the complete assignment.

AUTHOR’S AND TESTER’S SOLUTIONS:

The solution can be found here.

//