17
1
using System;
2
using System.Linq;
3
4
public class Program {
5
public static void Main() {
6
int ppp = 111;
7
for (int ef = 10; ef < 100; ef++) {
8
int gh = ppp - ef;
9
for (int cd = 10; cd < 100; cd++) {
10
int ab = ef + cd;
11
if (new int[]{ef, gh, ab, cd}.SelectMany(o => new int[]{ o / 10, o % 10}).Distinct().Where(o => o != 1).Count() == 8 && ab > 9 && ab < 100) {
12
Console.WriteLine(string.Format("{0} - {1} = {2} + {3} = 111", ab, cd, ef, gh));
13
}
14
}
15
}
16
}
17
}
Cached Result