結果

問題 No.882 約数倍数
ユーザー papinianus
提出日時 2025-03-02 00:40:39
言語 PHP
(843.2)
結果
AC  
実行時間 53 ms / 500 ms
コード長 1,166 bytes
コンパイル時間 1,113 ms
コンパイル使用メモリ 36,032 KB
実行使用メモリ 36,632 KB
最終ジャッジ日時 2025-03-02 00:40:42
合計ジャッジ時間 2,015 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
declare(strict_types=1);
[$a, $b] = UtilIO::getIntArray();
$ans = UtilIO::boolInYesNo($a % $b === 0);
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 boolInYesNo(bool $val, $word = ["YES", "NO"]):string {
        return $val ? $word[0] : $word[1];
    }
    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