結果

問題 No.1064 ∪∩∩ / Cup Cap Cap
ユーザー ui_mtc
提出日時 2020-03-30 02:08:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 911 bytes
コンパイル時間 1,656 ms
コンパイル使用メモリ 167,816 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-27 02:20:39
合計ジャッジ時間 2,589 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define int long long 
#define double long double
using namespace std;
using Graph = vector<vector<int>>;


signed main(){
  cout << fixed << setprecision(15);
  double a, b, c, d;
  cin >> a >> b >> c >> d;
  
  double k = sqrt((a-c)*(a-c)-8*(b-d));
  double ans1 = (c-a+k)/4.000000; //xの値
  double ans2 = (c-a-k)/4.000000;
  if( ans1 == ans2 ){
    if(abs(ans1*ans1+a*ans1+b - (-1*ans1*ans1 + c*ans1 + d)) < 0.0000001 ){
      cout << "Yes" << endl;
    }else cout << "No" << endl;
  }else{
    if( abs(ans1*ans1+a*ans1+b - (-1*ans1*ans1+c*ans1+d)) < 0.0000001 && abs(ans2*ans2+a*ans2+b - (-1*ans2*ans2+c*ans2+d)) < 0.0000001 ){
      double y1 = ans1*ans1+a*ans1+b;
      double y2 = ans2*ans2+a*ans2+b;
      double P = (y2-y1)/(ans2-ans1);
      double Q = -1*ans1*(y2-y1)/(ans2-ans1)+y1;
      cout << P << " " << Q << endl;
    }else{
      cout << "No" << endl;
    }
  }
}
0