結果
問題 |
No.419 直角三角形
|
ユーザー |
![]() |
提出日時 | 2016-11-07 19:18:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 673 bytes |
コンパイル時間 | 1,203 ms |
コンパイル使用メモリ | 159,412 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-25 04:21:06 |
合計ジャッジ時間 | 1,936 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> //const static double de_PI = 3.14159265358979323846; //const static int de_MOD = 1000000007; const static int de_MAX = 999999999; //const static int de_MIN = -999999999; int main(void) { //std::ifstream inf("123.txt"); std::cin.rdbuf(inf.rdbuf()); double a = 0, b = 0; std::cin >> a >> b; double ans1 = std::sqrt(a*a + b*b); double ans2 = de_MAX; if (a != b) { if (a < b) { ans2 = std::sqrt(b*b - a*a); } else { ans2 = std::sqrt(a*a - b*b); } } if (ans1 > ans2) { std::cout << std::fixed << std::setprecision(10) << ans2 << std::endl; } else { std::cout << std::fixed << std::setprecision(10) << ans1 << std::endl; } }