結果
問題 |
No.419 直角三角形
|
ユーザー |
|
提出日時 | 2016-10-03 11:56:43 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 679 bytes |
コンパイル時間 | 1,304 ms |
コンパイル使用メモリ | 158,684 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 15:09:16 |
合計ジャッジ時間 | 2,091 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 WA * 2 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define FOR(i,a,b) for(int i=a;i<b;i++) #define REP(i,b) FOR(i,0,b) using ll = long long; const ll mod = LLONG_MAX; double calc(double a,double b,double ret){ return a*a-ret*ret-b*b; } double pit(double a,double b){ double lb=0,ub=1000; double ret=(ub+lb)/2; REP(i,500){ ret = (ub+lb)/2; if(calc(a,b,ret)>0){ lb=ret; }else{ ub=ret; } } return ret; } int main(){ double sa,sa2; cin>>sa>>sa2; //saはsa2以上 if(sa2>sa){ swap(sa2,sa); } if(sa2==sa){ cout<<sqrt(sa*sa+sa2*sa2)<<endl; return 0; } cout<<fixed<<setprecision(10)<<pit(sa,sa2)<<endl; return 0; }