結果
問題 | No.419 直角三角形 |
ユーザー |
|
提出日時 | 2021-01-22 12:21:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 1,000 ms |
コード長 | 356 bytes |
コンパイル時間 | 1,480 ms |
コンパイル使用メモリ | 89,200 KB |
最終ジャッジ日時 | 2025-01-18 03:17:15 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include<iostream> #include<iomanip> #include<cmath> using namespace std; using ld = long double; int main(){ cout << fixed << setprecision(15); ld a,b; cin >> a >> b; ld c1 = sqrtl(a*a+b*b); ld c2 = a > b ? sqrtl(a*a-b*b) : sqrtl(b*b-a*a); ld ans = c1 > c2 && c2 != 0 ? c2 : c1; cout << ans << endl; return 0; }