Math.cs 959 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. namespace wf
  3. {
  4. public static class Math
  5. {
  6. public static int Round2(int num)
  7. {
  8. return Math.Min(Math.Max(num, 0), 99);
  9. }
  10. public static int Round3(int num)
  11. {
  12. return Math.Min(Math.Max(num, 0), 999);
  13. }
  14. public static int Round4(int num)
  15. {
  16. return Math.Min(Math.Max(num, 0), 9999);
  17. }
  18. public static int Round5(int num)
  19. {
  20. return Math.Min(Math.Max(num, 0), 99999);
  21. }
  22. public static long Round4(long num)
  23. {
  24. return Math.Min(Math.Max(num, 0L), 9999L);
  25. }
  26. public static long Round6(long num)
  27. {
  28. return Math.Min(Math.Max(num, 0L), 999999L);
  29. }
  30. public static int RoundMinMax(int num, int min, int max)
  31. {
  32. return Math.Min(Math.Max(num, min), max);
  33. }
  34. public static float RoundMinMax(float num, float min, float max)
  35. {
  36. return Math.Min(Math.Max(num, min), max);
  37. }
  38. public static long RoundMinMax(long num, long min, long max)
  39. {
  40. return Math.Min(Math.Max(num, min), max);
  41. }
  42. }
  43. }