結果

問題 No.735 接線
ユーザー papinianus
提出日時 2025-03-02 00:30:45
言語 PHP
(843.2)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 1,025 bytes
コンパイル時間 4,274 ms
コンパイル使用メモリ 35,988 KB
実行使用メモリ 36,884 KB
最終ジャッジ日時 2025-03-02 00:30:53
合計ジャッジ時間 7,395 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
declare(strict_types=1);
[$r, $d] = UtilIO::getFloatArray();
$ans = sqrt($d ** 2 - $r **2);
UtilIO::echo($ans);

class UtilIO {
    protected static string $n = PHP_EOL;
    protected function __construct() { }
    public static function getString():string {
        return trim(fgets(STDIN));
    }
    public static function getInt():int {
        return intval(static::getString());
    }
    public static function getStringArray($separator = " "):array {
        return explode($separator, static::getString());
    }
    public static function getIntArray($separator = " "):array {
        return array_map('intval', static::getStringArray($separator));
    }
    public static function getFloatArray($separator = " "):array {
        return array_map('floatval', static::getStringArray($separator));
    }
    public static function echo(string|int|float $val):void {
        echo static::toLine("$val");
    }
    public static function toLine(string $str):string {
        return trim($str).static::$n;
    }
}
0