結果

問題 No.800 四平方定理
ユーザー Yoichiro NishimuraYoichiro Nishimura
提出日時 2020-02-06 10:39:54
言語 PHP
(8.3.4)
結果
AC  
実行時間 1,501 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 32,376 KB
実行使用メモリ 108,192 KB
最終ジャッジ日時 2023-10-25 09:57:46
合計ジャッジ時間 20,584 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
32,500 KB
testcase_01 AC 49 ms
34,464 KB
testcase_02 AC 48 ms
34,464 KB
testcase_03 AC 47 ms
34,464 KB
testcase_04 AC 48 ms
34,464 KB
testcase_05 AC 48 ms
34,464 KB
testcase_06 AC 51 ms
34,464 KB
testcase_07 AC 49 ms
34,464 KB
testcase_08 AC 50 ms
34,464 KB
testcase_09 AC 50 ms
34,464 KB
testcase_10 AC 536 ms
71,328 KB
testcase_11 AC 580 ms
71,328 KB
testcase_12 AC 664 ms
71,328 KB
testcase_13 AC 722 ms
71,328 KB
testcase_14 AC 696 ms
71,328 KB
testcase_15 AC 712 ms
71,328 KB
testcase_16 AC 695 ms
71,328 KB
testcase_17 AC 720 ms
71,328 KB
testcase_18 AC 684 ms
71,328 KB
testcase_19 AC 629 ms
71,328 KB
testcase_20 AC 43 ms
32,500 KB
testcase_21 AC 43 ms
32,500 KB
testcase_22 AC 694 ms
71,328 KB
testcase_23 AC 1,444 ms
108,192 KB
testcase_24 AC 1,384 ms
108,192 KB
testcase_25 AC 1,501 ms
108,192 KB
testcase_26 AC 45 ms
32,500 KB
testcase_27 AC 44 ms
32,500 KB
testcase_28 AC 1,329 ms
108,192 KB
testcase_29 AC 1,331 ms
108,192 KB
testcase_30 AC 1,351 ms
108,192 KB
testcase_31 AC 1,192 ms
108,192 KB
testcase_32 AC 1,421 ms
108,192 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 - $d;
    for($w = $n; $w > 0; --$w){
        $p = $w*$w - $Z;
        if(isset($map[$p])){
            $count+=$map[$p];
        }
    }
}
echo $count;
0