結果
問題 | No.1064 ∪∩∩ / Cup Cap Cap |
ユーザー |
|
提出日時 | 2020-05-29 21:52:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 792 bytes |
コンパイル時間 | 438 ms |
コンパイル使用メモリ | 60,964 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-06 04:00:35 |
合計ジャッジ時間 | 1,582 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 36 |
ソースコード
#include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <vector> #include <queue> int main() { /* input */ long a, b, c, d; scanf( "%ld %ld %ld %ld", &a, &b, &c, &d ); /* process */ long check = ( a - c ) * ( a - c ) - 8 * ( b - d ); /* output */ if ( check < 0 ) { printf( "No\n" ); } else if ( check == 0 ) { printf( "Yes\n" ); } else { double x_1 = ( - ( a - c ) / 2.0 - std::sqrt( check / 4.0 ) ) / 2; double x_2 = ( - ( a - c ) / 2.0 + std::sqrt( check / 4.0 ) ) / 2; double p = ( ( x_1 * x_1 + a * x_1 + b ) - ( x_2 * x_2 + a * x_2 + b ) ) / ( x_1 - x_2 ); double q = ( x_1 * x_1 + a * x_1 + b ) - p * x_1; printf( "%.7lf %.7lf\n", p, q ); } return 0; }