fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. ios_base::sync_with_stdio(false);
  7. cin.tie(NULL);
  8.  
  9. long long code, quantity;
  10. if (cin >> code >> quantity) {
  11. if (code < 1 || code > 5 || quantity <= 0) {
  12. cout << "Invalid\n";
  13. return 0;
  14. }
  15.  
  16. long long price = 0;
  17. if (code == 1) price = 50000;
  18. else if (code == 2) price = 80000;
  19. else if (code == 3) price = 60000;
  20. else if (code == 4) price = 70000;
  21. else if (code == 5) price = 40000;
  22.  
  23. long long total = price * quantity;
  24.  
  25. if (total >= 300000) {
  26. total = total * 90 / 100;
  27. } else if (total >= 150000) {
  28. total = total * 95 / 100;
  29. }
  30.  
  31. cout << total << "\n";
  32. }
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty