QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 2048 MB Total points: 100

#14437. 艺术装置

Statistics

Jolie 正在为她的猫 Millie 搭建一个艺术装置。该艺术装置将由多个 LED 灯组成。

Jolie 决定她需要特定数量的红色 LED、绿色 LED 和蓝色 LED。在翻找书桌后,她发现了一些现有的 LED。她可以购买两种特殊类型的 LED,一种可以是红色或绿色,另一种可以是绿色或蓝色。

Jolie 需要购买多少个特殊 LED 才能完成她的装置?

输入格式

第一行包含三个整数 $r, g$ 和 $b$ ($0 \le r, g, b \le 1,000$),分别表示 Jolie 需要的红色、绿色和蓝色 LED 的数量。

第二行包含三个整数 $c_r, c_g$ 和 $c_b$ ($0 \le c_r, c_g, c_b \le 1,000$),分别表示 Jolie 已经拥有的红色、绿色和蓝色 LED 的数量。

第三行包含两个整数 $c_{rg}$ 和 $c_{gb}$ ($0 \le c_{rg}, c_{gb} \le 2,000$),分别表示可供 Jolie 购买的“红色或绿色”特殊 LED 的数量,以及“绿色或蓝色”特殊 LED 的数量。

输出格式

输出一个整数,表示 Jolie 为完成装置需要购买的 LED 总数。如果现有的 LED 不足以完成装置,则输出 $-1$。

样例

样例输入 1

583 290 710
396 65 796
309 800

样例输出 1

412

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.