Universal Cup Judging System

Universal Cup

時間限制: 1.0 s 記憶體限制: 256 MB 總分: 100 可 Hack ✓
统计

題目描述

你是學校程式設計競賽隊的隊長,正帶領同學們前往重慶參加 CCPC。根據隊伍的傳統,作為隊長,你需要請同學們吃飯,而你計畫去吃當地的特色美食——火鍋。

根據統計,隊伍中有 $x$ 名同學只吃辣,$y$ 名同學只吃不辣,還有 $z$ 名同學既能吃辣也能吃不辣。你們去的火鍋店提供三種鍋底:

  • 辣鍋:最多可供兩名能吃辣的同學食用,每份價格為 $a$ 元。
  • 鴛鴦鍋:最多可供一名能吃辣的同學和最多一名吃不辣的同學食用,每份價格為 $b$ 元。
  • 清湯鍋:最多可供兩名吃不辣的同學食用,每份價格為 $c$ 元。

你想知道,在確保所有同學都能依照自己的飲食偏好享用到火鍋的前提下,最少需要花費多少錢。

輸入格式

單一測試檔案中包含多筆測試資料。輸入的第一行包含一個整數 $T$($1 \le T \le 2025$),代表測試資料的組數。

對於每筆測試資料:

  • 每行包含 $6$ 個正整數 $x, y, z, a, b, c$($1 \le x, y, z, a, b, c \le 2025$),分別代表每類同學的人數以及三種火鍋的價格。

輸出格式

對於每筆測試資料,在單行中輸出一個整數,代表確保所有同學都能依照自己的飲食偏好享用到火鍋所需的最小可能花費。

範例

範例輸入 1

6
3 1 4 1 5 9
1 1 4 5 1 4
1 5 2 8 2 3
9 6 2 3 5 10
1 5 8 2 8 7
1 9 5 10 3 5

範例輸出 1

8
3
9
39
29
26

備註

  • 在第一個範例中,你可以讓所有既能吃辣也能吃不辣的同學都吃辣,然後點三個辣鍋和一個鴛鴦鍋,總花費為 $1 \times 3 + 5 \times 1 = 8$。
  • 在第二個範例中,你可以讓既能吃辣也能吃不辣的同學中有兩人吃辣、兩人吃不辣,然後點三個鴛鴦鍋,總花費為 $1 \times 3 = 3$。

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.