結果

問題 No.800 四平方定理
ユーザー Yoichiro NishimuraYoichiro Nishimura
提出日時 2019-04-26 12:52:00
言語 PHP
(8.3.4)
結果
AC  
実行時間 1,560 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 32,276 KB
実行使用メモリ 108,092 KB
最終ジャッジ日時 2024-05-03 06:47:38
合計ジャッジ時間 20,986 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
31,760 KB
testcase_01 AC 52 ms
32,780 KB
testcase_02 AC 44 ms
32,780 KB
testcase_03 AC 45 ms
32,784 KB
testcase_04 AC 44 ms
32,396 KB
testcase_05 AC 46 ms
32,780 KB
testcase_06 AC 49 ms
32,908 KB
testcase_07 AC 48 ms
32,904 KB
testcase_08 AC 50 ms
33,032 KB
testcase_09 AC 50 ms
33,036 KB
testcase_10 AC 662 ms
69,868 KB
testcase_11 AC 669 ms
70,120 KB
testcase_12 AC 656 ms
69,992 KB
testcase_13 AC 691 ms
69,996 KB
testcase_14 AC 746 ms
69,992 KB
testcase_15 AC 749 ms
70,252 KB
testcase_16 AC 706 ms
69,992 KB
testcase_17 AC 734 ms
70,380 KB
testcase_18 AC 667 ms
70,120 KB
testcase_19 AC 635 ms
69,864 KB
testcase_20 AC 36 ms
31,200 KB
testcase_21 AC 36 ms
31,144 KB
testcase_22 AC 708 ms
69,996 KB
testcase_23 AC 1,543 ms
108,092 KB
testcase_24 AC 1,475 ms
106,984 KB
testcase_25 AC 1,530 ms
108,088 KB
testcase_26 AC 35 ms
31,352 KB
testcase_27 AC 35 ms
31,216 KB
testcase_28 AC 1,345 ms
108,088 KB
testcase_29 AC 1,543 ms
106,728 KB
testcase_30 AC 1,473 ms
106,732 KB
testcase_31 AC 1,255 ms
106,732 KB
testcase_32 AC 1,560 ms
107,956 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

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