Advertisement
Ruslan_Isaev

i'm zaebalsa

Sep 26th, 2020
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Прибытие_короля
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. {
  14. int a = int.Parse(Console.ReadLine());
  15. int b = int.Parse(Console.ReadLine());
  16. int c = int.Parse(Console.ReadLine());
  17. int time = 0;
  18. int[] sunduki = new int[3] { a, b, c }; //3 7 5
  19. Array.Sort(sunduki); //3 5 7
  20. int x, y, z;
  21. x = sunduki[0];
  22. y = sunduki[1];
  23. z = sunduki[2];
  24.  
  25. if (x != z && z != y)
  26. {
  27.  
  28. while (x != z)
  29. {
  30. x++;
  31. sunduki[1]++;
  32. time++;
  33. }
  34. while (x != y)
  35. {
  36. x++;
  37. sunduki[2]++;
  38. time++;
  39. }
  40. }
  41. if ((x == y) || (y == z))
  42. {
  43. if (x == y && x < z)
  44. {
  45. x++;
  46. y++;
  47. time++;
  48. }
  49. if (y == z && x < y)
  50. {
  51. while (x != z)
  52. {
  53. x++;
  54. y++;
  55. time++;
  56. }
  57. while (z != y)
  58. {
  59. x++;
  60. z++;
  61. time++;
  62. }
  63. }
  64. }
  65. Console.WriteLine(time);
  66. Console.ReadKey();
  67. }
  68. }
  69. }
  70. }
  71.  
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement