diki chalani..
pre uplne presne pochopenie som spravil toto:
Kód: Vybrať všetko
<?php
header('Content-Type: text/html; charset=utf-8');
echo "<pre>";
$d = array("4,10", "3,30");
echo "POCET S1A S1B S1C A S2A S2B S2C B";
echo "\n";
for ($loop = 1; $loop <= 250; $loop ++)
{
echo $loop . " ";
foreach ($d as $key => $data)
{
$get_param = explode(",", $data);
if (!isset($count[$key]))
{
$count[$key] = $get_param[1];
}
$ratio = $get_param[1] * (1 / $loop);
$decimal_count = strlen($ratio) - strrpos($ratio, ".") - 1;
if ($decimal_count > 5)
{
$ratio = "-";
}
elseif ($count[$key] >= 0)
{
$count[$key] --;
}
if ($count[$key] >= 0)
{
$main_counter[$key] = ($loop + $count[$key]);
}
elseif ($stop[$key] == FALSE)
{
$stop[$key] = TRUE;
$main_counter[$key] ++;
}
echo "(" . $decimal_count . ") " . $ratio . " ";
echo $count[$key] . " [" . $main_counter[$key] . "]" . " ";
}
echo "\n";
}
echo "</pre>";
?>
po spusteni s toho vyleze presne to co potrebujem:
(pretoze sa to trocha rozletelo tak pripajam aj txt subor)
Kód: Vybrať všetko
POCET S1A S1B S1C A S2A S2B S2C B
1 (1) 10 9 [10] (1) 30 29 [30]
2 (0) 5 8 [10] (1) 15 28 [30]
3 (13) - 8 [11] (1) 10 27 [30]
4 (1) 2.5 7 [11] (1) 7.5 26 [30]
5 (0) 2 6 [11] (0) 6 25 [30]
6 (13) - 6 [12] (0) 5 24 [30]
7 (13) - 6 [13] (13) - 24 [31]
8 (2) 1.25 5 [13] (2) 3.75 23 [31]
9 (13) - 5 [14] (13) - 23 [32]
10 (0) 1 4 [14] (0) 3 22 [32]
11 (14) - 4 [15] (13) - 22 [33]
12 (14) - 4 [16] (1) 2.5 21 [33]
13 (14) - 4 [17] (13) - 21 [34]
14 (14) - 4 [18] (13) - 21 [35]
15 (14) - 4 [19] (0) 2 20 [35]
16 (3) 0.625 3 [19] (3) 1.875 19 [35]
17 (14) - 3 [20] (13) - 19 [36]
18 (14) - 3 [21] (13) - 19 [37]
19 (14) - 3 [22] (13) - 19 [38]
20 (1) 0.5 2 [22] (1) 1.5 18 [38]
21 (14) - 2 [23] (13) - 18 [39]
22 (14) - 2 [24] (13) - 18 [40]
23 (14) - 2 [25] (12) - 18 [41]
24 (14) - 2 [26] (2) 1.25 17 [41]
25 (1) 0.4 1 [26] (1) 1.2 16 [41]
26 (14) - 1 [27] (13) - 16 [42]
27 (14) - 1 [28] (13) - 16 [43]
28 (14) - 1 [29] (13) - 16 [44]
29 (13) - 1 [30] (13) - 16 [45]
30 (14) - 1 [31] (0) 1 15 [45]
31 (14) - 1 [32] (14) - 15 [46]
32 (4) 0.3125 0 [32] (4) 0.9375 14 [46]
33 (13) - 0 [33] (14) - 14 [47]
34 (14) - 0 [34] (14) - 14 [48]
35 (14) - 0 [35] (14) - 14 [49]
36 (14) - 0 [36] (14) - 14 [50]
37 (14) - 0 [37] (14) - 14 [51]
38 (14) - 0 [38] (14) - 14 [52]
39 (14) - 0 [39] (14) - 14 [53]
40 (2) 0.25 -1 [40] (2) 0.75 13 [53]
41 (14) - -1 [40] (14) - 13 [54]
42 (14) - -1 [40] (14) - 13 [55]
43 (14) - -1 [40] (14) - 13 [56]
44 (14) - -1 [40] (14) - 13 [57]
45 (14) - -1 [40] (14) - 13 [58]
46 (14) - -1 [40] (14) - 13 [59]
47 (14) - -1 [40] (14) - 13 [60]
48 (14) - -1 [40] (3) 0.625 12 [60]
49 (14) - -1 [40] (14) - 12 [61]
50 (1) 0.2 -1 [40] (1) 0.6 11 [61]
51 (14) - -1 [40] (14) - 11 [62]
52 (14) - -1 [40] (14) - 11 [63]
53 (14) - -1 [40] (14) - 11 [64]
54 (14) - -1 [40] (14) - 11 [65]
55 (14) - -1 [40] (14) - 11 [66]
56 (14) - -1 [40] (14) - 11 [67]
57 (14) - -1 [40] (14) - 11 [68]
58 (14) - -1 [40] (14) - 11 [69]
59 (14) - -1 [40] (14) - 11 [70]
60 (14) - -1 [40] (1) 0.5 10 [70]
61 (14) - -1 [40] (14) - 10 [71]
62 (14) - -1 [40] (14) - 10 [72]
63 (14) - -1 [40] (14) - 10 [73]
64 (5) 0.15625 -1 [40] (5) 0.46875 9 [73]
65 (14) - -1 [40] (14) - 9 [74]
66 (14) - -1 [40] (14) - 9 [75]
67 (14) - -1 [40] (14) - 9 [76]
68 (14) - -1 [40] (14) - 9 [77]
69 (14) - -1 [40] (14) - 9 [78]
70 (14) - -1 [40] (14) - 9 [79]
71 (14) - -1 [40] (14) - 9 [80]
72 (14) - -1 [40] (14) - 9 [81]
73 (14) - -1 [40] (14) - 9 [82]
74 (14) - -1 [40] (14) - 9 [83]
75 (14) - -1 [40] (1) 0.4 8 [83]
76 (14) - -1 [40] (14) - 8 [84]
77 (14) - -1 [40] (14) - 8 [85]
78 (14) - -1 [40] (14) - 8 [86]
79 (14) - -1 [40] (14) - 8 [87]
80 (3) 0.125 -1 [40] (3) 0.375 7 [87]
81 (14) - -1 [40] (14) - 7 [88]
82 (13) - -1 [40] (14) - 7 [89]
83 (14) - -1 [40] (14) - 7 [90]
84 (14) - -1 [40] (14) - 7 [91]
85 (14) - -1 [40] (14) - 7 [92]
86 (14) - -1 [40] (14) - 7 [93]
87 (14) - -1 [40] (13) - 7 [94]
88 (14) - -1 [40] (14) - 7 [95]
89 (13) - -1 [40] (14) - 7 [96]
90 (14) - -1 [40] (14) - 7 [97]
91 (14) - -1 [40] (14) - 7 [98]
92 (14) - -1 [40] (14) - 7 [99]
93 (14) - -1 [40] (14) - 7 [100]
94 (13) - -1 [40] (14) - 7 [101]
95 (14) - -1 [40] (14) - 7 [102]
96 (14) - -1 [40] (4) 0.3125 6 [102]
97 (14) - -1 [40] (14) - 6 [103]
98 (14) - -1 [40] (14) - 6 [104]
99 (13) - -1 [40] (13) - 6 [105]
100 (1) 0.1 -1 [40] (1) 0.3 5 [105]
101 (15) - -1 [40] (13) - 5 [106]
102 (15) - -1 [40] (14) - 5 [107]
103 (15) - -1 [40] (14) - 5 [108]
104 (15) - -1 [40] (14) - 5 [109]
105 (15) - -1 [40] (14) - 5 [110]
106 (15) - -1 [40] (14) - 5 [111]
107 (15) - -1 [40] (13) - 5 [112]
108 (15) - -1 [40] (14) - 5 [113]
109 (15) - -1 [40] (14) - 5 [114]
110 (15) - -1 [40] (14) - 5 [115]
111 (14) - -1 [40] (14) - 5 [116]
112 (15) - -1 [40] (14) - 5 [117]
113 (15) - -1 [40] (14) - 5 [118]
114 (15) - -1 [40] (14) - 5 [119]
115 (14) - -1 [40] (14) - 5 [120]
116 (15) - -1 [40] (14) - 5 [121]
117 (15) - -1 [40] (14) - 5 [122]
118 (15) - -1 [40] (14) - 5 [123]
119 (15) - -1 [40] (14) - 5 [124]
120 (15) - -1 [40] (2) 0.25 4 [124]
121 (15) - -1 [40] (14) - 4 [125]
122 (15) - -1 [40] (14) - 4 [126]
123 (14) - -1 [40] (14) - 4 [127]
124 (15) - -1 [40] (14) - 4 [128]
125 (2) 0.08 -1 [40] (2) 0.24 3 [128]
126 (15) - -1 [40] (14) - 3 [129]
127 (15) - -1 [40] (14) - 3 [130]
128 (6) - -1 [40] (6) - 3 [131]
129 (15) - -1 [40] (14) - 3 [132]
130 (15) - -1 [40] (14) - 3 [133]
131 (15) - -1 [40] (14) - 3 [134]
132 (15) - -1 [40] (14) - 3 [135]
133 (15) - -1 [40] (14) - 3 [136]
134 (15) - -1 [40] (14) - 3 [137]
135 (15) - -1 [40] (14) - 3 [138]
136 (15) - -1 [40] (14) - 3 [139]
137 (15) - -1 [40] (14) - 3 [140]
138 (15) - -1 [40] (14) - 3 [141]
139 (15) - -1 [40] (13) - 3 [142]
140 (15) - -1 [40] (14) - 3 [143]
141 (15) - -1 [40] (14) - 3 [144]
142 (15) - -1 [40] (13) - 3 [145]
143 (14) - -1 [40] (14) - 3 [146]
144 (15) - -1 [40] (14) - 3 [147]
145 (15) - -1 [40] (14) - 3 [148]
146 (15) - -1 [40] (14) - 3 [149]
147 (15) - -1 [40] (14) - 3 [150]
148 (15) - -1 [40] (13) - 3 [151]
149 (15) - -1 [40] (14) - 3 [152]
150 (15) - -1 [40] (1) 0.2 2 [152]
151 (15) - -1 [40] (14) - 2 [153]
152 (15) - -1 [40] (14) - 2 [154]
153 (15) - -1 [40] (14) - 2 [155]
154 (15) - -1 [40] (14) - 2 [156]
155 (15) - -1 [40] (14) - 2 [157]
156 (15) - -1 [40] (14) - 2 [158]
157 (15) - -1 [40] (14) - 2 [159]
158 (15) - -1 [40] (14) - 2 [160]
159 (15) - -1 [40] (14) - 2 [161]
160 (4) 0.0625 -1 [40] (4) 0.1875 1 [161]
161 (15) - -1 [40] (14) - 1 [162]
162 (15) - -1 [40] (14) - 1 [163]
163 (15) - -1 [40] (13) - 1 [164]
164 (15) - -1 [40] (14) - 1 [165]
165 (15) - -1 [40] (14) - 1 [166]
166 (15) - -1 [40] (14) - 1 [167]
167 (15) - -1 [40] (14) - 1 [168]
168 (14) - -1 [40] (14) - 1 [169]
169 (15) - -1 [40] (14) - 1 [170]
170 (15) - -1 [40] (14) - 1 [171]
171 (15) - -1 [40] (14) - 1 [172]
172 (15) - -1 [40] (14) - 1 [173]
173 (15) - -1 [40] (14) - 1 [174]
174 (15) - -1 [40] (14) - 1 [175]
175 (15) - -1 [40] (14) - 1 [176]
176 (15) - -1 [40] (14) - 1 [177]
177 (15) - -1 [40] (14) - 1 [178]
178 (15) - -1 [40] (13) - 1 [179]
179 (14) - -1 [40] (14) - 1 [180]
180 (15) - -1 [40] (14) - 1 [181]
181 (14) - -1 [40] (14) - 1 [182]
182 (15) - -1 [40] (14) - 1 [183]
183 (15) - -1 [40] (14) - 1 [184]
184 (15) - -1 [40] (14) - 1 [185]
185 (15) - -1 [40] (14) - 1 [186]
186 (15) - -1 [40] (14) - 1 [187]
187 (15) - -1 [40] (14) - 1 [188]
188 (15) - -1 [40] (14) - 1 [189]
189 (15) - -1 [40] (14) - 1 [190]
190 (15) - -1 [40] (14) - 1 [191]
191 (15) - -1 [40] (14) - 1 [192]
192 (15) - -1 [40] (5) 0.15625 0 [192]
193 (15) - -1 [40] (14) - 0 [193]
194 (15) - -1 [40] (14) - 0 [194]
195 (15) - -1 [40] (14) - 0 [195]
196 (15) - -1 [40] (13) - 0 [196]
197 (15) - -1 [40] (14) - 0 [197]
198 (15) - -1 [40] (14) - 0 [198]
199 (15) - -1 [40] (14) - 0 [199]
200 (2) 0.05 -1 [40] (2) 0.15 -1 [200]
201 (15) - -1 [40] (14) - -1 [200]
202 (14) - -1 [40] (14) - -1 [200]
203 (15) - -1 [40] (14) - -1 [200]
204 (15) - -1 [40] (14) - -1 [200]
205 (15) - -1 [40] (14) - -1 [200]
206 (15) - -1 [40] (14) - -1 [200]
207 (15) - -1 [40] (14) - -1 [200]
208 (15) - -1 [40] (14) - -1 [200]
209 (15) - -1 [40] (14) - -1 [200]
210 (15) - -1 [40] (14) - -1 [200]
211 (14) - -1 [40] (14) - -1 [200]
212 (15) - -1 [40] (14) - -1 [200]
213 (15) - -1 [40] (14) - -1 [200]
214 (15) - -1 [40] (14) - -1 [200]
215 (15) - -1 [40] (14) - -1 [200]
216 (15) - -1 [40] (14) - -1 [200]
217 (15) - -1 [40] (14) - -1 [200]
218 (15) - -1 [40] (14) - -1 [200]
219 (15) - -1 [40] (14) - -1 [200]
220 (15) - -1 [40] (14) - -1 [200]
221 (15) - -1 [40] (14) - -1 [200]
222 (15) - -1 [40] (14) - -1 [200]
223 (15) - -1 [40] (14) - -1 [200]
224 (15) - -1 [40] (14) - -1 [200]
225 (15) - -1 [40] (14) - -1 [200]
226 (15) - -1 [40] (14) - -1 [200]
227 (15) - -1 [40] (14) - -1 [200]
228 (15) - -1 [40] (14) - -1 [200]
229 (15) - -1 [40] (14) - -1 [200]
230 (15) - -1 [40] (13) - -1 [200]
231 (15) - -1 [40] (14) - -1 [200]
232 (15) - -1 [40] (14) - -1 [200]
233 (15) - -1 [40] (14) - -1 [200]
234 (15) - -1 [40] (14) - -1 [200]
235 (15) - -1 [40] (14) - -1 [200]
236 (15) - -1 [40] (13) - -1 [200]
237 (15) - -1 [40] (14) - -1 [200]
238 (15) - -1 [40] (14) - -1 [200]
239 (13) - -1 [40] (13) - -1 [200]
240 (15) - -1 [40] (3) 0.125 -1 [200]
241 (14) - -1 [40] (14) - -1 [200]
242 (15) - -1 [40] (14) - -1 [200]
243 (15) - -1 [40] (14) - -1 [200]
244 (15) - -1 [40] (14) - -1 [200]
245 (15) - -1 [40] (14) - -1 [200]
246 (15) - -1 [40] (13) - -1 [200]
247 (15) - -1 [40] (14) - -1 [200]
248 (15) - -1 [40] (14) - -1 [200]
249 (15) - -1 [40] (14) - -1 [200]
250 (2) 0.04 -1 [40] (2) 0.12 -1 [200]
- POCET je stlpec v ktorom je hodnota X, ktoru poznam
- S1A/S2A su stlpce, kde sa zobrazuje info o pocte desatinnych miest daneho vysledku pre vzorec $ratio = $get_param[1] * (1 / $loop);
- S2A/S2B su stlpce zo samotnym vysledkom zo vzorca. - znaci, ze cislo ma viac ako 5 desatinnych miest
- S3A/S3B su stlpce, ktore obsahuju hodnotu vypocitanu tak, ze akonahle ma vysledok <= 5 desatinnych miest, tak jednoducho odpocitam od pociatocnej hodnoty -1 (A=10, B=30)
- A/B su stlpce z vysledkom, ktory pozadujem dosiahnut a je to jednoduchy sucet POCTU + SxC
bohuzial takto je to premna nepouzitelne nakolko nemozem zakazdym preskenovat data a zistit tak o aku hodnotu ma byt znizena SxC pretoze ta sa teraz vypocitava v cykle FOR. potrebujem jeden vzorec, ktory ak aplikujem na POCET dostanem podobny, alebo rovnaky vysledok. takze ak ja mam momentalne POCET = 14 potrebujem cez vzorec dostat A=18 a B=35, alebo ak POCET=44 tak A=40 a B=57 atd..
vsetko sa da zistit z kodu na zaciatku, alebo stiahnut zrarovany txt subor z vysledkami ked tu to to zle zformatovalo.
DIK.