CF898B.Proper Nutrition

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vasya has nn burles. One bottle of Ber-Cola costs aa burles and one Bars bar costs bb 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 nn burles.

In other words, you should find two non-negative integers xx and yy such that Vasya can buy xx bottles of Ber-Cola and yy Bars bars and xa+yb=nx·a+y·b=n or tell that it's impossible.

输入格式

First line contains single integer nn ( 1<=n<=100000001<=n<=10000000 ) — amount of money, that Vasya has.

Second line contains single integer aa ( 1<=a<=100000001<=a<=10000000 ) — cost of one bottle of Ber-Cola.

Third line contains single integer bb ( 1<=b<=100000001<=b<=10000000 ) — cost of one Bars bar.

输出格式

If Vasya can't buy Bars and Ber-Cola in such a way to spend exactly nn burles print «NO» (without quotes).

Otherwise in first line print «YES» (without quotes). In second line print two non-negative integers xx and yy — number of bottles of Ber-Cola and number of Bars bars Vasya should buy in order to spend exactly nn burles, i.e. xa+yb=nx·a+y·b=n . If there are multiple answers print any of them.

Any of numbers xx and yy can be equal 00 .

输入输出样例

  • 输入#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 22+13=72·2+1·3=7 burles.

In second example Vasya can spend exactly nn 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 1010 Bars bars.

In third example it's impossible to but Ber-Cola and Bars bars in order to spend exactly nn burles.

首页