fork download
  1. // your code goes here
  2.  
  3.  
  4.  
  5. function calc(m) {
  6. var ret = 900;
  7. if (m <= 1000) {
  8. return ret;
  9. }
  10. var _m = m - 1000;
  11. var _n1 = parseInt(_m / 500);
  12. var _n2 = (_m % 500) == 0;
  13. return ret + (300 * (_n1+ (_n2?0:1)) ) ;
  14. }
  15.  
  16.  
  17. print(calc(500));
  18. print(calc(1000));
  19. print(calc(1001));
  20. print(calc(1200));
  21. print(calc(1201));
  22. print(calc(1601));
  23.  
Success #stdin #stdout 0s 16848KB
stdin
Standard input is empty
stdout
900
900
1200
1200
1200
1500