結果

問題 No.800 四平方定理
ユーザー Yoichiro NishimuraYoichiro Nishimura
提出日時 2019-04-26 12:49:40
言語 PHP
(8.3.4)
結果
AC  
実行時間 1,734 ms / 2,000 ms
コード長 458 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 31,024 KB
実行使用メモリ 108,220 KB
最終ジャッジ日時 2024-05-03 06:44:40
合計ジャッジ時間 21,905 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
31,884 KB
testcase_01 AC 52 ms
32,908 KB
testcase_02 AC 47 ms
32,592 KB
testcase_03 AC 48 ms
32,908 KB
testcase_04 AC 48 ms
32,652 KB
testcase_05 AC 48 ms
32,780 KB
testcase_06 AC 53 ms
33,040 KB
testcase_07 AC 50 ms
32,648 KB
testcase_08 AC 52 ms
32,912 KB
testcase_09 AC 49 ms
33,036 KB
testcase_10 AC 696 ms
69,864 KB
testcase_11 AC 720 ms
69,992 KB
testcase_12 AC 675 ms
69,996 KB
testcase_13 AC 722 ms
69,992 KB
testcase_14 AC 681 ms
70,120 KB
testcase_15 AC 745 ms
69,992 KB
testcase_16 AC 695 ms
70,248 KB
testcase_17 AC 736 ms
70,116 KB
testcase_18 AC 693 ms
69,736 KB
testcase_19 AC 696 ms
70,120 KB
testcase_20 AC 37 ms
31,100 KB
testcase_21 AC 38 ms
31,068 KB
testcase_22 AC 732 ms
69,868 KB
testcase_23 AC 1,721 ms
108,088 KB
testcase_24 AC 1,466 ms
108,216 KB
testcase_25 AC 1,610 ms
108,220 KB
testcase_26 AC 36 ms
31,312 KB
testcase_27 AC 35 ms
31,228 KB
testcase_28 AC 1,412 ms
106,984 KB
testcase_29 AC 1,437 ms
106,988 KB
testcase_30 AC 1,549 ms
107,964 KB
testcase_31 AC 1,421 ms
106,856 KB
testcase_32 AC 1,734 ms
108,088 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++){
        if(isset($map[$x*$x + $y*$y])){
            $map[$x*$x + $y*$y]++;
        }else{
            $map[$x*$x + $y*$y] = 1;
        }
    }
}
$count = 0;
for($z = 1; $z <= $n; $z++){
    for($w = 1; $w <= $n; $w++){
        if(isset($map[$w*$w - $z*$z + $d])){
            $count+=$map[$w*$w - $z*$z + $d];
        }
    }
}
echo $count;
0