16
1
using System;
2
using System.Linq;
3
4
public class Program {
5
public static void Main() {
6
int ppp = 111;
7
foreach (var x in from ef in Enumerable.Range(10, 99)
8
from cd in Enumerable.Range(10, 99)
9
let gh = ppp - ef
10
let ab = ef + cd
11
where 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
select new {AB = ab, CD = cd, EF= ef, GH = gh}){
13
Console.WriteLine(string.Format("{0} - {1} = {2} + {3} = 111", x.AB, x.CD, x.EF, x.GH));
14
}
15
}
16
}
Cached Result