結果

問題 No.1157 Many Quotients easy
ユーザー papinianus
提出日時 2025-03-02 00:56:35
言語 PHP
(843.2)
結果
WA  
実行時間 -
コード長 1,247 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 36,372 KB
実行使用メモリ 38,772 KB
最終ジャッジ日時 2025-03-02 00:56:38
合計ジャッジ時間 2,844 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
declare(strict_types=1);
$n = UtilIO::getInt();
$m = ceil($n / 2);
$all = [$n];
for($i = 2; $i <= $m; $i++) {
    $all[] = intval(floor($n / $i));
}
$ans = count(array_unique($all));
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