├── 71A.php ├── lightoj1002.php ├── 1462C.php ├── 580c.php └── 1141D.php /71A.php: -------------------------------------------------------------------------------- 1 | 10) { 9 | $abbreviation = $word[0] . (strlen($word) - 2) . $word[strlen($word) - 1]; 10 | echo $abbreviation . PHP_EOL; 11 | } else { 12 | echo $word . PHP_EOL; 13 | } 14 | } 15 | 16 | ?> 17 | -------------------------------------------------------------------------------- /lightoj1002.php: -------------------------------------------------------------------------------- 1 | 25 | -------------------------------------------------------------------------------- /1462C.php: -------------------------------------------------------------------------------- 1 | 45) { 6 | return -1; 7 | } 8 | 9 | $number = ''; 10 | $digit = 9; 11 | 12 | while ($x > 0) { 13 | // If x is less than the current digit, append it to the number 14 | if ($x <= $digit) { 15 | $number .= $x; 16 | $x = 0; 17 | } else { 18 | // Otherwise, append the current digit to the number 19 | $number .= $digit; 20 | $x -= $digit; 21 | $digit--; 22 | } 23 | } 24 | 25 | // Reverse the string to get the smallest number 26 | $number = strrev($number); 27 | 28 | return $number; 29 | } 30 | 31 | $testCases = intval(trim(fgets(STDIN))); 32 | 33 | for ($t = 0; $t < $testCases; $t++) { 34 | $x = intval(trim(fgets(STDIN))); 35 | $result = find_smallest_number($x); 36 | echo $result . "\n"; 37 | } 38 | 39 | ?> 40 | -------------------------------------------------------------------------------- /580c.php: -------------------------------------------------------------------------------- 1 | $m) { 22 | return; 23 | } 24 | }else{ 25 | $cN = 0; 26 | } 27 | if ($c == 1 && $map[$cur][0] == $dest) { 28 | $result++; 29 | return; 30 | } 31 | 32 | for ($i = 0; $i < $c; $i++) { 33 | if ($map[$cur][$i] == $dest) { 34 | continue; 35 | } 36 | solve($cur, $map[$cur][$i], $cN); 37 | } 38 | 39 | } 40 | 41 | solve(0, 1, 0); 42 | echo $result; -------------------------------------------------------------------------------- /1141D.php: -------------------------------------------------------------------------------- 1 | [],'b' => [],'c' => [],'d' => [],'e' => [],'f' => [],'g' => [],'h' => [],'i' => [],'j' => [],'k' => [], 11 | 'l' => [],'m' => [],'n' => [],'o' => [],'p' => [],'q' => [],'r' => [],'s' => [],'t' => [],'u' => [],'v' => [], 12 | 'w' => [],'x' => [],'y' => [],'z' => [], '?' => [], 13 | ]; 14 | $keys = array_keys($leftItems); 15 | 16 | $left = fgets(STDIN); 17 | $right = fgets(STDIN); 18 | for ($i = 0, $j = 1; $i < $itemsCount; $i++, $j++) { 19 | $leftItems[$left[$i]][] = $j; 20 | $rightItems[$right[$i]][] = $j; 21 | } 22 | unset($left, $right); 23 | 24 | foreach ($keys as $key) { 25 | while ($leftItems[$key] !== [] && $rightItems[$key] !== []) { 26 | $result++; 27 | $pairs[] = array_pop($leftItems[$key]) . ' ' . array_pop($rightItems[$key]); 28 | } 29 | while ($leftItems[$key] !== [] && $rightItems['?'] !== []) { 30 | $result++; 31 | $pairs[] = array_pop($leftItems[$key]) . ' ' . array_pop($rightItems['?']); 32 | } 33 | while ($leftItems['?'] !== [] && $rightItems[$key] !== []) { 34 | $result++; 35 | $pairs[] = array_pop($leftItems['?']) . ' ' . array_pop($rightItems[$key]); 36 | } 37 | } 38 | print $result . PHP_EOL . implode(PHP_EOL, $pairs); --------------------------------------------------------------------------------