public class cie {
static int d;
static int k;
static int r;
static int poz[];
// public static void bin(int di) {
// int l = 0;
// int p = r - 1;
// int w1 = 0;
// int s = 0;
// while (l <= p) {
// s = (l + p) / 2;
// poz[di] = s;
// int w = cielib.czyCieplo(poz);
// if (w == 1) {
// w1 = s;
// }
// if (w1 == 1 && w == 0) {
// s = w1;
// break;
// }
//
// if (w > 0) {
// l = s + 1;
// } else {
// p = s - 1;
// }
// }
// poz[di] = s;
//
// for (int i = 0; i < d; i++) {
// System.out.print(poz[i] + " ");
// }
// }
public static void bin(int di) {
int w1 = 0;
for (int i = 0; i < r; i++) {
poz[di] = i;
int w = cielib.czyCieplo(poz);
if (w == 1) {
w1 = i;
}
if (w1 > 0 && w == 0) {
break;
}
}
poz[di] = w1;
// for (int i = 0; i < d; i++) {
// System.out.print(poz[i] + " ");
// }
// System.out.println("w1:" + w1);
}
public static void main(String[] args) {
d = cielib.podajD();
k = cielib.podajK();
r = cielib.podajR();
poz = new int[d];
for (int di = 0; di < d; di++) {
poz[di] = 0;
}
cielib.czyCieplo(poz);
int di = 0;
while (di < d) {
bin(di);
di++;
}
cielib.znalazlem(poz);
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | public class cie { static int d; static int k; static int r; static int poz[]; // public static void bin(int di) { // int l = 0; // int p = r - 1; // int w1 = 0; // int s = 0; // while (l <= p) { // s = (l + p) / 2; // poz[di] = s; // int w = cielib.czyCieplo(poz); // if (w == 1) { // w1 = s; // } // if (w1 == 1 && w == 0) { // s = w1; // break; // } // // if (w > 0) { // l = s + 1; // } else { // p = s - 1; // } // } // poz[di] = s; // // for (int i = 0; i < d; i++) { // System.out.print(poz[i] + " "); // } // } public static void bin(int di) { int w1 = 0; for (int i = 0; i < r; i++) { poz[di] = i; int w = cielib.czyCieplo(poz); if (w == 1) { w1 = i; } if (w1 > 0 && w == 0) { break; } } poz[di] = w1; // for (int i = 0; i < d; i++) { // System.out.print(poz[i] + " "); // } // System.out.println("w1:" + w1); } public static void main(String[] args) { d = cielib.podajD(); k = cielib.podajK(); r = cielib.podajR(); poz = new int[d]; for (int di = 0; di < d; di++) { poz[di] = 0; } cielib.czyCieplo(poz); int di = 0; while (di < d) { bin(di); di++; } cielib.znalazlem(poz); } } |
English