結果

問題 No.550 夏休みの思い出(1)
ユーザー takeya_okinotakeya_okino
提出日時 2017-07-30 11:52:37
言語 PHP
(8.3.4)
結果
AC  
実行時間 455 ms / 2,000 ms
コード長 649 bytes
コンパイル時間 1,277 ms
コンパイル使用メモリ 32,144 KB
実行使用メモリ 32,660 KB
最終ジャッジ日時 2024-04-19 13:19:25
合計ジャッジ時間 9,659 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
32,400 KB
testcase_01 AC 437 ms
32,528 KB
testcase_02 AC 435 ms
32,528 KB
testcase_03 AC 436 ms
32,528 KB
testcase_04 AC 453 ms
32,276 KB
testcase_05 AC 433 ms
32,528 KB
testcase_06 AC 453 ms
32,468 KB
testcase_07 AC 450 ms
32,528 KB
testcase_08 AC 455 ms
32,528 KB
testcase_09 AC 35 ms
32,400 KB
testcase_10 AC 35 ms
32,532 KB
testcase_11 AC 35 ms
32,528 KB
testcase_12 AC 34 ms
32,528 KB
testcase_13 AC 34 ms
32,656 KB
testcase_14 AC 35 ms
32,404 KB
testcase_15 AC 36 ms
32,464 KB
testcase_16 AC 35 ms
32,528 KB
testcase_17 AC 34 ms
32,532 KB
testcase_18 AC 33 ms
32,528 KB
testcase_19 AC 34 ms
32,656 KB
testcase_20 AC 34 ms
32,400 KB
testcase_21 AC 33 ms
32,400 KB
testcase_22 AC 299 ms
32,660 KB
testcase_23 AC 143 ms
32,528 KB
testcase_24 AC 202 ms
32,532 KB
testcase_25 AC 233 ms
32,396 KB
testcase_26 AC 190 ms
32,528 KB
testcase_27 AC 182 ms
32,364 KB
testcase_28 AC 175 ms
32,528 KB
testcase_29 AC 81 ms
32,400 KB
testcase_30 AC 362 ms
32,528 KB
testcase_31 AC 37 ms
32,336 KB
testcase_32 AC 36 ms
32,528 KB
testcase_33 AC 38 ms
32,560 KB
testcase_34 AC 34 ms
32,404 KB
testcase_35 AC 35 ms
32,656 KB
testcase_36 AC 33 ms
32,400 KB
testcase_37 AC 36 ms
32,340 KB
testcase_38 AC 33 ms
32,400 KB
testcase_39 AC 33 ms
32,532 KB
testcase_40 AC 70 ms
32,148 KB
testcase_41 AC 63 ms
32,532 KB
testcase_42 AC 71 ms
32,400 KB
testcase_43 AC 53 ms
32,528 KB
testcase_44 AC 59 ms
32,400 KB
testcase_45 AC 55 ms
32,660 KB
testcase_46 AC 65 ms
32,656 KB
testcase_47 AC 39 ms
32,528 KB
testcase_48 AC 34 ms
32,340 KB
testcase_49 AC 34 ms
32,400 KB
testcase_50 AC 32 ms
32,528 KB
testcase_51 AC 32 ms
32,404 KB
testcase_52 AC 52 ms
32,404 KB
testcase_53 AC 53 ms
32,400 KB
testcase_54 AC 53 ms
32,404 KB
testcase_55 AC 54 ms
32,532 KB
testcase_56 AC 54 ms
32,400 KB
testcase_57 AC 53 ms
32,528 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$array = explode(" ", trim(fgets(STDIN)));
$A = $array[0];
$B = $array[1];
$C = $array[2];
$x1 = 0;
for($i = 0; $i < pow(10, 6); $i++) {
  $x = $i;
  $y = pow($x, 3) + $A * pow($x, 2) + $B * $x + $C;
  if($y == 0) {
    $x1 = $x;
    break;
  }
  $x = (-1) * $i;
  $y = pow($x, 3) + $A * pow($x, 2) + $B * $x + $C;
  if($y == 0) {
    $x1 = $x;
    break;
  }
}
$b = $A + $x1;
$c = $x1 * $A + pow($x1, 2) + $B;
$x2 = ((-1) * $b - sqrt(pow($b, 2) - 4 * $c)) / 2;
$x3 = ((-1) * $b + sqrt(pow($b, 2) - 4 * $c)) / 2;
$ans = array($x1, $x2, $x3);
sort($ans);
for($i = 0; $i < 3; $i++) {
  print($ans[$i]);
  if($i < 2) print(" ");
}
print("\n");
?>
0