-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharc174-b.cpp
More file actions
43 lines (42 loc) · 739 Bytes
/
arc174-b.cpp
File metadata and controls
43 lines (42 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <bits/stdc++.h>
using namespace std;
#define int long long
int a[6], w[6], dp[10001];
int solve()
{
int sum = 0;
for (int i = 1; i <= 5; i++)
{
cin >> a[i];
}
for (int i = 1; i <= 5; i++)
{
sum += (3 - i) * a[i];
cin >> w[i];
}
if (sum <= 0)
{
cout << 0 << endl;
// system("pause");
return 0;
}
if (sum > 0)
{
int w1 = min(w[4], w[5] + w[2]);
int w2 = w[5];
cout << min(sum * w1, min((sum + 1) / 2 * w2, (sum) / 2 * w2 + (sum & 1) * w1)) << endl;
return 0;
}
return 0;
}
signed main()
{
int t;
cin >> t;
while (t--)
{
solve();
}
system("pause");
return 0;
}