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
#include <cmath>
#include "cielib.h"


int p[500];
int low[500];
int high[500];

int d, k, r;


void binaryEliminate(int i)
{
	p[i] = low[i];
	czyCieplo(p);
	
	p[i] = high[i];
	
	if(czyCieplo(p))
		low[i] = low[i] + (high[i] - low[i]) / 2;
	else
		high[i] = high[i] - (high[i] - low[i]) / 2;
		
	p[i] = low[i] + (high[i] - low[i]) / 2;
}


void getFinalPos(int i)
{
	int res1, res2;
	
	p[i] = low[i];
	czyCieplo(p);
	p[i] = low[i] + (high[i] - low[i]) / 2;
	res1 = czyCieplo(p);
	
	p[i] = high[i];
	czyCieplo(p);
	p[i] = low[i] + (high[i] - low[i]) / 2;
	res2 = czyCieplo(p);
		
	if(res1 == 1 && res2 == 0)
		p[i] = high[i];
	else if(res1 == 0 && res2 == 1)
		p[i] = low[i];
	else
		p[i] = low[i] + (high[i] - low[i]) / 2;
}



int main()
{

	d = podajD();
	k = podajK();
	r = podajR();
	
	// Init
	for(int i = 0; i < d; ++i)
	{
		low[i] = 0;
		high[i] = r;
		p[i] = low[i] + (high[i] - low[i]) / 2;
	}
	
	while(high[0] - low[0] > 2)
		for(int i = 0; i < d; ++i)
			binaryEliminate(i);
	
	for(int i = 0; i < d; ++i)
		getFinalPos(i);
	
	znalazlem(p);
	
	return 0;
}