304707: CF898B. Proper Nutrition

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Proper Nutrition

题意翻译

你应该找到两个非负整数X和Y,表示瓦西亚可以买到X瓶可乐和Y瓶酒使得X·A + Y·B=n 或告诉它是不可能的。 输入格式: 第一行,一个整数n(1<=n<=10000000)表示瓦西亚有多少钱。 第二行,一个整数a (1<=a<=10000000) 表示每瓶可乐多少钱。 第三行, 一个整数b (1<=b<=10000000) 表示每瓶酒多少钱。

题目描述

Vasya has $ n $ burles. One bottle of Ber-Cola costs $ a $ burles and one Bars bar costs $ b $ burles. He can buy any non-negative integer number of bottles of Ber-Cola and any non-negative integer number of Bars bars. Find out if it's possible to buy some amount of bottles of Ber-Cola and Bars bars and spend exactly $ n $ burles. In other words, you should find two non-negative integers $ x $ and $ y $ such that Vasya can buy $ x $ bottles of Ber-Cola and $ y $ Bars bars and $ x·a+y·b=n $ or tell that it's impossible.

输入输出格式

输入格式


First line contains single integer $ n $ ( $ 1<=n<=10000000 $ ) — amount of money, that Vasya has. Second line contains single integer $ a $ ( $ 1<=a<=10000000 $ ) — cost of one bottle of Ber-Cola. Third line contains single integer $ b $ ( $ 1<=b<=10000000 $ ) — cost of one Bars bar.

输出格式


If Vasya can't buy Bars and Ber-Cola in such a way to spend exactly $ n $ burles print «NO» (without quotes). Otherwise in first line print «YES» (without quotes). In second line print two non-negative integers $ x $ and $ y $ — number of bottles of Ber-Cola and number of Bars bars Vasya should buy in order to spend exactly $ n $ burles, i.e. $ x·a+y·b=n $ . If there are multiple answers print any of them. Any of numbers $ x $ and $ y $ can be equal $ 0 $ .

输入输出样例

输入样例 #1

7
2
3

输出样例 #1

YES
2 1

输入样例 #2

100
25
10

输出样例 #2

YES
0 10

输入样例 #3

15
4
8

输出样例 #3

NO

输入样例 #4

9960594
2551
2557

输出样例 #4

YES
1951 1949

说明

In first example Vasya can buy two bottles of Ber-Cola and one Bars bar. He will spend exactly $ 2·2+1·3=7 $ burles. In second example Vasya can spend exactly $ n $ burles multiple ways: - buy two bottles of Ber-Cola and five Bars bars; - buy four bottles of Ber-Cola and don't buy Bars bars; - don't buy Ber-Cola and buy $ 10 $ Bars bars. In third example it's impossible to but Ber-Cola and Bars bars in order to spend exactly $ n $ burles.

Input

题意翻译

你应该找到两个非负整数X和Y,表示瓦西亚可以买到X瓶可乐和Y瓶酒使得X·A + Y·B=n 或告诉它是不可能的。 输入格式: 第一行,一个整数n(1<=n<=10000000)表示瓦西亚有多少钱。 第二行,一个整数a (1<=a<=10000000) 表示每瓶可乐多少钱。 第三行, 一个整数b (1<=b<=10000000) 表示每瓶酒多少钱。

加入题单

上一题 下一题 算法标签: