C. 买文具

    Type: Default 1000ms 256MiB

买文具

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

开学了,小明来到文具店选购文具。签字笔 22 元一支,他需要 XX 支;记事本 55 元一本,他需要 YY 本;直尺 33 元一把,他需要 ZZ 把。小明手里有 QQ 元钱。请你通过编程帮小明算算,他手里的钱是否够买他需要的文具。

输入格式

第一行包含一个正整数,是小明购买签字笔的数量。约定 1X101 \le X \le 10

第二行包含一个正整数,是小明购买记事本的数量。约定 1Y101 \le Y \le 10

第三行包含一个正整数,是小明购买直尺的数量。约定 1Z101 \le Z \le 10

第四行包含一个正整数 QQ,是小明手里的钱数(单位:元)。

输出格式

输出 22 行。如果小明手里的钱够买他需要的文具,则第一行输出 Yes,第二行输出小明会剩下的钱数(单位:元);否则,第一行输出 No,第二行输出小明缺少的钱数(单位:元)。

样例输入 #1

1
1
1
20

样例输出 #1

Yes
10

样例输入 #2

1
1
1
5

样例输出 #2

No
5

来源

2023 年 9 月 GESP C++ 等级考试。

华业C++一班 阶段测试(01-05)

Not Attended
Status
Done
Rule
IOI
Problem
3
Start at
2024-11-7 18:00
End at
2024-11-7 21:00
Duration
1 hour(s)
Host
Partic.
4