Advertisement
Ruslan_Isaev

у меня беды с башкой

Sep 26th, 2020
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 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 = sunduki[0];
  21. int y = sunduki[1];
  22. int z = sunduki[2];
  23.  
  24. if (x != z && z != y)
  25. {
  26.  
  27. while (x != z)
  28. {
  29. x++;
  30. y++;
  31. time++;
  32. }
  33. while (x != y)
  34. {
  35. x++;
  36. z++;
  37. time++;
  38. }
  39. }
  40. if ((x == y) || (y == z))
  41. {
  42. if (x == y && x < z)
  43. {
  44. x++;
  45. y++;
  46. time++;
  47. }
  48. if (y == z && x < y)
  49. {
  50. while (x != z)
  51. {
  52. x++;
  53. y++;
  54. time++;
  55. }
  56. while (z != y)
  57. {
  58. x++;
  59. z++;
  60. time++;
  61. }
  62. }
  63. }
  64. Console.WriteLine(time);
  65. Console.ReadKey();
  66. }
  67. }
  68. }
  69. }
  70.  
  71.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement