#P8012. [COCI 2013/2014 #4] NASLJEDSTVO
[COCI 2013/2014 #4] NASLJEDSTVO
Problem Description
There is a pile of coins. Someone splits this pile into parts as evenly as possible and takes one part away, leaving coins.
By “splitting into parts as evenly as possible”, we mean dividing the coins into piles, where each pile contains an integer number of coins, and the difference in the number of coins between any two piles is at most .
We assume that the part taken by this person is one of the smaller parts.
Please find the minimum and the maximum possible number of coins in the original pile.
Input Format
The first line contains a positive integer , meaning the pile is split into equal parts.
The second line contains a positive integer , meaning that after taking part out of the parts, there are coins left.
Output Format
Output one line with two positive integers, representing the minimum and the maximum possible number of coins in the original pile.
2
5
9 10
3
5
7 7
Hint
Sample Explanation #1
The original pile could have had coins. The person could have split it into and taken .
The original pile could have had coins. The person could have split it into and taken .
Constraints
For of the testdata, , .
Source
The score of this problem follows the original COCI problem setting, with a full score of .
Translated from COCI2013-2014 CONTEST #4 T1 NASLJEDSTVO。
Translated by ChatGPT 5