Advertisement
Sanlover

Untitled

Mar 25th, 2022
845
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. using std::cout;
  3. using std::cin;
  4.  
  5. int main()
  6. {
  7.     int lineAmount, discountCategory, i = 0, price, category, amount;
  8.     float discount, summary = 0;
  9.  
  10.     cin >> lineAmount >> discountCategory >> discount;
  11.     for (; i < lineAmount; i++)
  12.     {
  13.         cin >> price >> category >> amount;
  14.         summary += (category == discountCategory ? price - price * discount : price) * amount;
  15.     }
  16.     cout << static_cast<int>(summary);
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement