C. [GESP202309 一级] 买文具

    Type: Default 1000ms 256MiB

[GESP202309 一级] 买文具

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.

Description

开学了,小明来到文具店选购文具。签字笔 2 元一支,他需要 X 支;记事本 5 元一本,他需要 Y 本;直尺 3 元一把,他需要 Z 把。小明手里有 Q 元钱。请你通过编程帮小明算算,他手里的钱是否够买他需要的文具。

Input Format

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

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

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

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

Output Format

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

1
1
1
20
Yes
10
1
1
1
5
No
5

华业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