QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 1024 MB 總分: 100

#3197. 蜡烛盒

统计

Rita 热爱她的生日派对。每当在《Happy Birthday》的旋律中吹灭蜡烛时,她总是非常开心。从四岁开始,她每年都会往蜡烛盒里放入生日蜡烛(每增长一岁放一根)。她的弟弟 Theo 从三岁开始也做了同样的事情。Rita 和 Theo 的盒子看起来一模一样,里面的蜡烛也是。

有一天,Rita 决定数一数她盒子里有多少根蜡烛: — 不,不对!我比这年轻! 她刚刚意识到,这些年来她往盒子里扔掉了一些生日蜡烛。你能帮 Rita 修正她蜡烛盒里的蜡烛数量吗?

给定 Rita 和 Theo 的年龄差,Rita 盒子里的蜡烛数量,以及 Theo 盒子里的蜡烛数量,求出 Rita 需要从她的盒子里移除多少根蜡烛,才能使盒子里的蜡烛数量正确。

第一行包含一个整数 $D$,表示 Rita 和 Theo 的年龄差。 第二行包含一个整数 $R$,表示 Rita 盒子里的蜡烛数量。 第三行包含一个整数 $T$,表示 Theo 盒子里的蜡烛数量。

$1 \le D \le 20$:Rita 和 Theo 的年龄差 $4 \le R < 1000$:Rita 盒子里的蜡烛数量 $0 \le T < 1000$:Theo 盒子里的蜡烛数量

输出一个整数,表示 Rita 必须从她的盒子里移除的蜡烛数量,以使盒子里的蜡烛数量正确。

样例

输入格式 1

2
26
8

输出格式 1

4

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.