62042023-11-08 08:28:02EsVagyBevásárláscpp17Accepted 100/1003ms3852 KiB
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    const int prices[] = { 300, 350, 400 };

    int a, b, c;
    cin >> a >> b >> c;

    int counts[] = { a, b, c };

    int p = 10;
    int price = 0;

    for (int i = 0; i < 3; i++)
    {
        int bought = min(counts[i], p);
        price += bought * prices[i];
        p -= bought;
        if (p == 0)
        {
            break;
        }
    }

    if (p != 0)
    {
        price = -1;
    }

    cout << price;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1880 KiB
2Accepted3ms2112 KiB
3Accepted3ms2280 KiB
subtask210/10
4Accepted2ms2396 KiB
5Accepted3ms2516 KiB
6Accepted3ms2728 KiB
subtask320/20
7Accepted2ms2788 KiB
8Accepted2ms2908 KiB
9Accepted3ms2928 KiB
10Accepted2ms3036 KiB
subtask430/30
11Accepted2ms3240 KiB
12Accepted2ms3328 KiB
13Accepted2ms3320 KiB
14Accepted2ms3472 KiB
subtask540/40
15Accepted2ms3508 KiB
16Accepted3ms3540 KiB
17Accepted2ms3484 KiB
18Accepted2ms3484 KiB
19Accepted2ms3608 KiB
20Accepted3ms3852 KiB