#ZL13205. 带额外赠送的盈亏挑战
带额外赠送的盈亏挑战
带额外赠送的盈亏挑战
题目描述
把奖品分给 n 名学生。第一种方案每人 a 个,另给班长 gift 个,最后还剩 remain 个,因此 total=a×n+gift+remain;第二种方案每人 b 个,还差 lack 个,因此 total=b×n-lack。
输入格式
一行输入五个整数 a、gift、remain、b、lack,其中 a、b、remain、lack>0,gift≥0。
输出格式
由 (b-a)×n=gift+remain+lack 求 n。若 b≤a、不能整除,或算出的 n、total 不是正整数,输出 IMPOSSIBLE;否则输出 n 和 total。
样例
输入
4 2 10 6 4
输出
8 44