Решение
using System;
using System.Collections.Generic;
namespace NeuronMapping {
class Program {
static void Main() {
List numbersList = new List();
uint inputNumber = 0;
while (true) {
if (uint.TryParse(Console.ReadLine(), out inputNumber)) {
numbersList.Add(inputNumber);
} else {
break;
}
}
for (int i = 0; i < numbersList.Count; i++) {
for (int j = 0; j < 32; j++) {
uint mask = (uint) 1 << j;
uint numberAndMask = numbersList[i] & mask;
uint bit = numberAndMask >> j;
if (bit == 1) {
break;
} else {
numbersList[i] = numbersList[i] | mask;
}
}
}
for (int i = 0; i < numbersList.Count; i++) {
for (int j = 31; j >= 0; j--) {
uint mask = (uint) 1 << j;
uint numberAndMask = numbersList[i] & mask;
uint bit = numberAndMask >> j;
if (bit == 1) {
break;
} else {
numbersList[i] = numbersList[i] | mask;
}
}
}
for (int i = 0; i < numbersList.Count; i++) {
for (int j = 0; j < 32; j++) {
uint mask = (uint) 1 << j;
numbersList[i] = mask ^ numbersList[i];
}
Console.WriteLine(numbersList[i]);
}
}
}
}