#include <bits/stdc++.h>
#include "cielib.h"
using namespace std;
const int N = 5e3 + 7;
int d, k, R;
int t[N], p[N], l[N], r[N];
int main()
{
d = podajD(), k = podajK(), R = podajR();
for(int i = 0; i < d; i++)
r[i] = R;
int n = R + 1;
bool x = 0;
while(n > 3)
{
for(int i = 0; i < d; i++)
t[i] = (l[i] + r[i]) / 2;
for(int i = 0; i < d; i++)
{
int m = t[i];
t[i] = l[i];
x = czyCieplo(t);
t[i] = r[i];
x = czyCieplo(t);
t[i] = m;
if(x)
{
(n & 1) ? l[i] = m : l[i] = m;
}
else
{
(n & 1) ? r[i] = m : r[i] = m + 1;
}
}
n = (n >> 1) + 1;
}
for(int i = 0; i < d; i++)
t[i] = (l[i] + r[i]) / 2;
for(int i = 0; i < d; i++)
{
int m = t[i];
t[i] = l[i];
x = czyCieplo(t);
t[i] = r[i];
x = czyCieplo(t);
if(x){
l[i] = r[i];
}
else{
t[i] = l[i];
x = czyCieplo(t);
x ? r[i] = l[i] : l[i] = r[i] = m;
}
}
znalazlem(l);
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #include <bits/stdc++.h> #include "cielib.h" using namespace std; const int N = 5e3 + 7; int d, k, R; int t[N], p[N], l[N], r[N]; int main() { d = podajD(), k = podajK(), R = podajR(); for(int i = 0; i < d; i++) r[i] = R; int n = R + 1; bool x = 0; while(n > 3) { for(int i = 0; i < d; i++) t[i] = (l[i] + r[i]) / 2; for(int i = 0; i < d; i++) { int m = t[i]; t[i] = l[i]; x = czyCieplo(t); t[i] = r[i]; x = czyCieplo(t); t[i] = m; if(x) { (n & 1) ? l[i] = m : l[i] = m; } else { (n & 1) ? r[i] = m : r[i] = m + 1; } } n = (n >> 1) + 1; } for(int i = 0; i < d; i++) t[i] = (l[i] + r[i]) / 2; for(int i = 0; i < d; i++) { int m = t[i]; t[i] = l[i]; x = czyCieplo(t); t[i] = r[i]; x = czyCieplo(t); if(x){ l[i] = r[i]; } else{ t[i] = l[i]; x = czyCieplo(t); x ? r[i] = l[i] : l[i] = r[i] = m; } } znalazlem(l); return 0; } |
English