Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: cyblox_boi

Problemset: Market Kalgulator

Language: cpp

Time: 0.004 second

Submitted On: 2025-12-29 22:43:53

#include <bits/stdc++.h>
using namespace std;

struct Croissant
{
    int quantity;
    int price;
};

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;

    vector<Croissant> croissants(n);
    double totalQuantity = 0;
    double totalPrice = 0;

    for (int i = 0; i < n; i++)
    {
        cin >> croissants[i].quantity >> croissants[i].price;

        totalQuantity += croissants[i].quantity;
        totalPrice += croissants[i].quantity * croissants[i].price;
    }

    double discount = 0;
    bool hasGotPromotion = false;

    if (totalQuantity >= 2 * n)
    {
        discount += (totalPrice * 0.03);

        if (totalQuantity > 14 && totalPrice - discount > 25)
        {
            discount += 10;
        }

        hasGotPromotion = true;
    }
    else if (totalQuantity <= 20 && totalPrice < 500)
    {
        totalPrice += 600;
        hasGotPromotion = true;
    }

    if (!hasGotPromotion)
    {
        discount += (n * 0.35);
    }

    cout << floor(totalPrice - discount) << '\n';

    return 0;
}