fork download
  1.  
  2. #include<algorithm>
  3. #include<iostream>
  4.  
  5. int GetScalingFactor(int input)
  6. {
  7. const unsigned int inputs[] = {13107, 19660, 26214, 32767, 39321, 45874, 52428, 58981};
  8. const int factors[] = {72816, 81918, 93621, 109225, 131070, 163837, 218450, 327675, 0};
  9.  
  10. auto it = std::lower_bound(std::begin(inputs), std::end(inputs), input + 1);
  11. return factors[std::distance(std::begin(inputs), it)];
  12. }
  13.  
  14. int main()
  15. {
  16. std::cout << GetScalingFactor(100) << std::endl;
  17. std::cout << GetScalingFactor(13107) << std::endl;
  18. std::cout << GetScalingFactor(15000) << std::endl;
  19. std::cout << GetScalingFactor(20000) << std::endl;
  20. std::cout << GetScalingFactor(30000) << std::endl;
  21. std::cout << GetScalingFactor(35000) << std::endl;
  22. std::cout << GetScalingFactor(40000) << std::endl;
  23. std::cout << GetScalingFactor(45875) << std::endl;
  24. std::cout << GetScalingFactor(55000) << std::endl;
  25. std::cout << GetScalingFactor(60000) << std::endl;
  26. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
72816
81918
81918
93621
109225
131070
163837
218450
327675
0