Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Прибытие_короля
- {
- class Program
- {
- static void Main(string[] args)
- {
- {
- int a = int.Parse(Console.ReadLine());
- int b = int.Parse(Console.ReadLine());
- int c = int.Parse(Console.ReadLine());
- int time = 0;
- int[] sunduki = new int[3] { a, b, c }; //3 7 5
- Array.Sort(sunduki); //3 5 7
- int x, y, z;
- x = sunduki[0];
- y = sunduki[1];
- z = sunduki[2];
- if (x != z && z != y)
- {
- while (x != z)
- {
- x++;
- sunduki[1]++;
- time++;
- }
- while (x != y)
- {
- x++;
- sunduki[2]++;
- time++;
- }
- }
- if ((x == y) || (y == z))
- {
- if (x == y && x < z)
- {
- x++;
- y++;
- time++;
- }
- if (y == z && x < y)
- {
- while (x != z)
- {
- x++;
- y++;
- time++;
- }
- while (z != y)
- {
- x++;
- z++;
- time++;
- }
- }
- }
- Console.WriteLine(time);
- Console.ReadKey();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement