fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int TEN = 10;
  5.  
  6. void applyDiscount(int &n) {
  7. if (n < 50) {
  8. n -= n / TEN;
  9. } else if (n <= TEN * TEN) {
  10. n -= n / TEN * 2;
  11. }
  12. }
  13.  
  14. int main() {
  15. int n;
  16. cin >> n;
  17. applyDiscount(n);
  18. cout << n;
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5320KB
stdin
110
stdout
110