結果

問題 No.800 四平方定理
ユーザー Yoichiro NishimuraYoichiro Nishimura
提出日時 2019-04-26 12:56:49
言語 PHP
(8.3.4)
結果
AC  
実行時間 1,957 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 3,038 ms
コンパイル使用メモリ 29,852 KB
実行使用メモリ 106,732 KB
最終ジャッジ日時 2024-05-03 06:53:40
合計ジャッジ時間 28,017 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
31,756 KB
testcase_01 AC 57 ms
32,528 KB
testcase_02 AC 58 ms
32,524 KB
testcase_03 AC 54 ms
32,652 KB
testcase_04 AC 51 ms
32,268 KB
testcase_05 AC 50 ms
32,528 KB
testcase_06 AC 54 ms
32,780 KB
testcase_07 AC 52 ms
32,656 KB
testcase_08 AC 54 ms
32,780 KB
testcase_09 AC 53 ms
32,908 KB
testcase_10 AC 824 ms
69,352 KB
testcase_11 AC 845 ms
69,612 KB
testcase_12 AC 859 ms
69,992 KB
testcase_13 AC 929 ms
69,736 KB
testcase_14 AC 895 ms
69,864 KB
testcase_15 AC 934 ms
69,740 KB
testcase_16 AC 903 ms
69,864 KB
testcase_17 AC 943 ms
69,864 KB
testcase_18 AC 860 ms
69,608 KB
testcase_19 AC 880 ms
69,864 KB
testcase_20 AC 40 ms
30,972 KB
testcase_21 AC 42 ms
30,980 KB
testcase_22 AC 963 ms
69,996 KB
testcase_23 AC 1,900 ms
106,728 KB
testcase_24 AC 1,791 ms
106,472 KB
testcase_25 AC 1,957 ms
106,600 KB
testcase_26 AC 41 ms
30,540 KB
testcase_27 AC 42 ms
30,824 KB
testcase_28 AC 1,816 ms
106,604 KB
testcase_29 AC 1,822 ms
106,732 KB
testcase_30 AC 1,865 ms
106,728 KB
testcase_31 AC 1,605 ms
106,600 KB
testcase_32 AC 1,955 ms
106,728 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 = $n; $y > 0 ;$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 = $n; $w > 0; $w--){
        $p = $w*$w - $Z + $d;
        if(isset($map[$p])){
            $count+=$map[$p];
        }
    }
}
echo $count;
0