2013-04-10 16:57:12 -07:00
|
|
|
void main() {
|
2015-02-20 00:35:01 -05:00
|
|
|
import std.stdio, std.math, std.algorithm, permutations2;
|
|
|
|
|
|
2013-04-10 16:57:12 -07:00
|
|
|
["Baker", "Cooper", "Fletcher", "Miller", "Smith"]
|
|
|
|
|
.permutations
|
|
|
|
|
.filter!(s =>
|
|
|
|
|
s.countUntil("Baker") != 4 && s.countUntil("Cooper") &&
|
|
|
|
|
s.countUntil("Fletcher") && s.countUntil("Fletcher") != 4 &&
|
|
|
|
|
s.countUntil("Miller") > s.countUntil("Cooper") &&
|
|
|
|
|
abs(s.countUntil("Smith") - s.countUntil("Fletcher")) != 1 &&
|
|
|
|
|
abs(s.countUntil("Cooper") - s.countUntil("Fletcher")) != 1)
|
|
|
|
|
.writeln;
|
|
|
|
|
}
|