m₃ m₄ | -1630.2
m₃z₃ m₄z₄ | 88464
m₃ m₄ | -4636.8
m₃z₃ m₄z₄ | -9772.88
import math
def main():
m_values = [40, 50, 60, 71, 76]
z_values = [160, 240, 320]
for m3 in m_values:
for m4 in m_values:
for z3 in z_values:
for z4 in z_values:
d = m3 * m4 * (z4 - z3)
if d == 0:
continue;
x3 = (-1630.2 * z4 - 88464) * m4 / d
x4 = (88464 + 1630.2 * z3) * m3 / d
y3 = (-4636.8 * z4 + 9772.88) * m4 / d
y4 = (-9772.88 + 4636.8 * z3) * m3 / d
r1 = math.sqrt(x3 * x3 + y3 * y3)
r2 = math.sqrt(x4 * x4 + y4 * y4)
if 42 <= r1 <= 88 and 42 <= r2 <= 88:
print("Найдено решение, удовлетворяющее условию 42 <= r <= 88:")
print(f" x3 = {x3_val:.2f}, x4 = {x4_val:.2f}")
print(f" y3 = {y3_val:.2f}, y4 = {y4_val:.2f}")
print(f" r1 = {r1:.2f}, r2 = {r2:.2f}")
print(f" Параметры: m3 = {m3}, m4 = {m4}, z3 = {z3}, z4 = {z4}")
return
print("Не найдено решений, удовлетворяющих условию 42 <= r <= 88.")
if __name__ == "__main__":
main()
Не найдено решений, удовлетворяющих условию 42 <= r <= 88.
00: 10 10: := 20: i
01: &a 11: i 21: output
02: := 12: 0 22:
03: a 13: >
04: 10 14: 12
05: + 15: 4
06: &b 16: <=
07: := 17: and
08: 12 18: 22
09: &i 19: jz
|-------------+------------+---------------------|
| customer_id | invoice_id | time_start |
|-------------+------------+---------------------|
| 1 | null | 2023-12-31 00:00:00 |
| 1 | 1 | 2024-02-01 00:00:00 |
|-------------+------------+---------------------|
<?php
/*
* Комната 0 введена для унификации алгоритма.
* Из неё можно попаст в любой выход, в неё попасть из других комнат нельзя.
*/
const NODES = [
0 => ['battleTime' => 0, 'loot' => 0],
1 => ['battleTime' => 5, 'loot' => 15],
2 => ['battleTime' => 2, 'loot' => 1],
3 => ['battleTime' => 3, 'loot' => 5],
4 => ['battleTime' => 3, 'loot' => 6],
5 => ['battleTime' => 4, 'loot' => 7],
6 => ['battleTime' => 5, 'loot' => 9],
7 => ['battleTime' => 7, 'loot' => 16],
8 => ['battleTime' => 2, 'loot' => 3],
9 => ['battleTime' => 0, 'loot' => 0],
10 => ['battleTime' => 0, 'loot' => 0],
];
const ROUTE_TIMES = [
0 => [9 => 0, 10 => 0],
1 => [2 => 1],
2 => [1 => 1, 8 => 2, 9 => 3, 4 => 1],
3 => [9 => 2, 4 => 4],
4 => [3 => 4, 2 => 1, 5 => 3],
5 => [4 => 3, 10 => 1],
6 => [10 => 4, 7 => 4],
7 => [8 => 4, 6 => 4],
8 => [2 => 2, 7 => 4, 10 => 6],
9 => [3 => 2, 2 => 3],
10 => [5 => 1, 8 => 6, 6 => 4],
];
const MAX_LIFETIME = 25;
function findRoute(array $state): array
{
$bestState = $state;
foreach (ROUTE_TIMES[$state['currentNode']] as $nextNode => $travelTime) {
$nodeTime = $state['lifetime'] + $travelTime +
(in_array($nextNode, $state['route']) ? 0 : NODES[$nextNode]['battleTime']);
if ($nodeTime > MAX_LIFETIME) {
continue;
}
$nodeState = findRoute([
'lifetime' => $nodeTime,
'currentNode' => $nextNode,
'wealth' => $state['wealth'] + (in_array($nextNode, $state['route']) ? 0 : NODES[$nextNode]['loot']),
'route' => [...$state['route'], $nextNode],
]);
if ($nodeState['wealth'] > $bestState['wealth']) {
$bestState = $nodeState;
}
}
return $bestState;
}
$state = findRoute([
'lifetime' => 0,
'currentNode' => 0,
'wealth' => 0,
'route' => [],
]);
echo "Route: ", implode(' => ', array_reverse($state['route'])), "\n";
echo "Wealth: ", $state['wealth'], "\n";
echo "Time: ", $state['lifetime'], "\n";
Route: 8 => 2 => 1 => 2 => 4 => 5 => 10
Wealth: 32
Time: 25
<meta charset="utf-8">
, то указанная вами кодировка utf-8 не совпадает с реальной кодировкой текста, отображаются вопросики.