#include "cielib.h" int main() { int d = podajD(); int coords[d]; int kon = podajR(); for(int i = 0; i < d; i++) { coords[i] = kon; } for(int i = 0; i < d; i++) { int l = 0; int p = kon; while(p - l > 1) { coords[i] = l; czyCieplo(coords); coords[i] = p; //printf("%d %d ", l, p); if(czyCieplo(coords) == 1) l = (int)((((long long)l + (long long)p)) / 2); else p = (int)((((long long)l + (long long)p)) / 2); //printf("%d %d\n", l, p); } //printf("\n\n\n"); coords[i] = l; czyCieplo(coords); coords[i] = p; if(czyCieplo(coords) == 1) coords[i] = p; else coords[i] = l; } znalazlem(coords); return 0; }
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 | #include "cielib.h" int main() { int d = podajD(); int coords[d]; int kon = podajR(); for(int i = 0; i < d; i++) { coords[i] = kon; } for(int i = 0; i < d; i++) { int l = 0; int p = kon; while(p - l > 1) { coords[i] = l; czyCieplo(coords); coords[i] = p; //printf("%d %d ", l, p); if(czyCieplo(coords) == 1) l = (int)((((long long)l + (long long)p)) / 2); else p = (int)((((long long)l + (long long)p)) / 2); //printf("%d %d\n", l, p); } //printf("\n\n\n"); coords[i] = l; czyCieplo(coords); coords[i] = p; if(czyCieplo(coords) == 1) coords[i] = p; else coords[i] = l; } znalazlem(coords); return 0; } |