Լավ խնդիր էր, հազիվ

վաղուց չի եղել:
Պատասխան, 1 3 9 27,
Ակնհայտ էր

Ծրագրավորումը մարդուն պչացնում ա, դրած անկապ կոմպ եմ մաշում, ու հլը քիչ ա չեմ մտախում, այլ ծրագիր եմ մի ամգամից գրու, ծրագիրնել առանց մտածելու պօլնիյ պերեբոր եմ անում: Ահավոր ա, ամոթ ա:
Կոդ:
import java.util.ArrayList;
import java.util.List;
public class Qarasun {
public static void main(String[] args) {
for (int a = 0; a < 40; a++) {
for (int b = 0; b < 40; b++) {
for (int c = 0; c < 40; c++) {
for (int d = 0; d < 40; d++) {
List<Integer> list = new ArrayList<Integer>();
for (int i = 0; i < 81; i++) {
int count = 0;
int ankap = i;
if (ankap % 3 == 0) {
count += a;
}
else if (ankap % 3 == 1) {
count -= a;
}
ankap = ankap / 3;
if (ankap % 3 == 0) {
count += b;
}
else if (ankap % 3 == 1) {
count -= b;
}
ankap = ankap / 3;
if (ankap % 3 == 0) {
count += c;
}
else if (ankap % 3 == 1) {
count -= c;
}
ankap = ankap / 3;
if (ankap % 3 == 0) {
count += d;
}
else if (ankap % 3 == 1) {
count -= d;
}
list.add(count);
}
boolean bool = true;
for (int i = 0; i < 41; i++) {
if (!list.contains(i)) {
bool = false;
}
}
if (bool) {
System.out.println(a + " " + b + " " + c + " " + d);
}
}
}
}
}
}
}
Էջանիշներ