Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Kidmaiok
Problemset: Market Kalgulator
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-05 11:27:58
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, order, price;
int total_items = 0;
double total_price = 0;
double real_price = 0;
bool used_promotion = false;
cin >> n;
for(int i = 0; i < n; i++){
cin >> order >> price;
total_items += order;
total_price += order * price;
}
if(total_items >= n * 2){
real_price = total_price * 0.97;
used_promotion = true;
if(total_items > 14 && real_price > 25){
real_price -= 10;
}
}
else if(total_items <= 20 && total_price < 500){
real_price = total_price + 600;
used_promotion = true;
}
if(!used_promotion){
real_price = total_price - ceil(n * 0.35); // changed floor -> ceil
}
cout << (int)floor(real_price) << endl;
return 0;
}