Restructuring

This commit is contained in:
2024-07-01 13:49:44 +00:00
parent f11b705ef0
commit 8d60e1b905
194 changed files with 1296 additions and 112 deletions

View File

@ -0,0 +1,18 @@
<?php
$words = explode('","',substr(file_get_contents('php://STDIN'),1,-1));
//Find triangles
for($t=1;$t<40;$t++) {
$triangle_numbers[] = 0.5*$t*($t+1);
}
foreach($words as $word) {
for($c =0; $c < strlen($word); $c++) {
$char_sum += ord($word[$c]) - 64;
}
if(in_array($char_sum,$triangle_numbers)) {
$result++;
}
$char_sum = 0;
}
echo $result;