結果

問題 No.550 夏休みの思い出(1)
ユーザー takeya_okinotakeya_okino
提出日時 2017-07-30 14:51:03
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 796 bytes
コンパイル時間 2,655 ms
コンパイル使用メモリ 30,368 KB
実行使用メモリ 31,196 KB
最終ジャッジ日時 2024-04-19 05:54:45
合計ジャッジ時間 5,226 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
30,944 KB
testcase_01 AC 34 ms
31,104 KB
testcase_02 AC 36 ms
31,088 KB
testcase_03 AC 37 ms
30,868 KB
testcase_04 AC 37 ms
31,060 KB
testcase_05 AC 36 ms
30,792 KB
testcase_06 AC 35 ms
30,700 KB
testcase_07 AC 35 ms
31,132 KB
testcase_08 AC 40 ms
30,924 KB
testcase_09 AC 34 ms
30,972 KB
testcase_10 AC 36 ms
30,856 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 38 ms
30,784 KB
testcase_14 AC 43 ms
30,680 KB
testcase_15 AC 36 ms
30,712 KB
testcase_16 AC 37 ms
30,796 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 35 ms
30,888 KB
testcase_20 AC 35 ms
30,720 KB
testcase_21 AC 37 ms
30,936 KB
testcase_22 AC 35 ms
30,920 KB
testcase_23 AC 34 ms
30,888 KB
testcase_24 AC 36 ms
30,832 KB
testcase_25 AC 36 ms
30,720 KB
testcase_26 AC 36 ms
30,568 KB
testcase_27 AC 39 ms
30,704 KB
testcase_28 AC 34 ms
30,820 KB
testcase_29 AC 34 ms
30,748 KB
testcase_30 AC 35 ms
30,680 KB
testcase_31 AC 43 ms
30,960 KB
testcase_32 AC 36 ms
30,656 KB
testcase_33 WA -
testcase_34 AC 43 ms
30,820 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 36 ms
30,700 KB
testcase_38 WA -
testcase_39 AC 36 ms
30,672 KB
testcase_40 AC 34 ms
31,108 KB
testcase_41 AC 36 ms
30,828 KB
testcase_42 AC 34 ms
31,064 KB
testcase_43 AC 34 ms
30,944 KB
testcase_44 AC 33 ms
30,888 KB
testcase_45 AC 32 ms
30,512 KB
testcase_46 AC 35 ms
30,796 KB
testcase_47 AC 35 ms
30,948 KB
testcase_48 AC 34 ms
30,936 KB
testcase_49 AC 37 ms
31,068 KB
testcase_50 AC 42 ms
30,512 KB
testcase_51 AC 39 ms
30,824 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$array = explode(" ", trim(fgets(STDIN)));
$A = $array[0];
$B = $array[1];
$C = $array[2];
$left = (-1) * pow(10, 9);
$right = pow(10, 9);
$x1 = 0;
while($right - $left > 1) {
  if((($left + $right) % 2 == 0) || ($left + $right >= 0)) {
    $med = intdiv($left + $right, 2);
  } else {
    $med = intdiv($left + $right - 1, 2);
  }
  $y = pow($med, 3) + $A * pow($med, 2) + $B * $med + $C;
  if($y > 0) {
    $right = $med;
  } else if($y < 0) {
    $left = $med;
  } else {
    $x1 = $med;
    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