TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

15 lines
381 B

<?php
function main(int $argc, array $argv): void
{
$iterations = $argc > 1 ? (int) $argv[1] : 10000000;
$checksum = 0;
for ($i = 0; $i < $iterations; ++$i) {
$damage = ($i % 101) - 20;
$hp = 100 - ($i % 100);
$damage = max(0, $damage);
$remaining = min($hp, $damage);
$checksum += $remaining;
}
echo $checksum, "\n";
}