結果

問題 No.800 四平方定理
ユーザー Yoichiro NishimuraYoichiro Nishimura
提出日時 2019-06-03 16:06:16
言語 PHP
(8.3.4)
結果
AC  
実行時間 1,966 ms / 2,000 ms
コード長 479 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 32,732 KB
実行使用メモリ 108,544 KB
最終ジャッジ日時 2023-10-17 23:25:52
合計ジャッジ時間 27,556 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
32,676 KB
testcase_01 AC 58 ms
34,632 KB
testcase_02 AC 55 ms
34,632 KB
testcase_03 AC 56 ms
34,636 KB
testcase_04 AC 54 ms
34,632 KB
testcase_05 AC 55 ms
34,632 KB
testcase_06 AC 60 ms
34,632 KB
testcase_07 AC 57 ms
34,632 KB
testcase_08 AC 63 ms
34,632 KB
testcase_09 AC 58 ms
34,632 KB
testcase_10 AC 889 ms
71,496 KB
testcase_11 AC 916 ms
71,496 KB
testcase_12 AC 907 ms
71,496 KB
testcase_13 AC 948 ms
71,496 KB
testcase_14 AC 966 ms
71,496 KB
testcase_15 AC 992 ms
71,496 KB
testcase_16 AC 968 ms
71,496 KB
testcase_17 AC 1,013 ms
71,496 KB
testcase_18 AC 956 ms
71,496 KB
testcase_19 AC 953 ms
71,496 KB
testcase_20 AC 43 ms
32,676 KB
testcase_21 AC 44 ms
32,676 KB
testcase_22 AC 1,028 ms
71,496 KB
testcase_23 AC 1,950 ms
108,360 KB
testcase_24 AC 1,825 ms
108,360 KB
testcase_25 AC 1,966 ms
108,544 KB
testcase_26 AC 43 ms
32,676 KB
testcase_27 AC 43 ms
32,676 KB
testcase_28 AC 1,772 ms
108,360 KB
testcase_29 AC 1,778 ms
108,360 KB
testcase_30 AC 1,842 ms
108,360 KB
testcase_31 AC 1,621 ms
108,360 KB
testcase_32 AC 1,947 ms
108,360 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
list($n, $d) = explode(" ", trim(fgets(STDIN)));
for($x = 1; $x <= $n; $x++){
    $X = $x*$x;
    for($y = 1; $y <= $n; $y++){
        $p = $X + $y*$y;
        if(isset($map[$p])){
            $map[$p]++;
        }else{
            $map[$p] = 1;
        }
    }
}
$count = 0;
for($z = 1; $z <= $n; $z++){
    $Z = $z*$z;
    for($w = 1; $w <= $n; $w++){
        $p = $w*$w - $Z + $d;
        if(isset($map[$p])){
            $count+=$map[$p];
        }
    }
}
echo $count;
0