結果
問題 | No.419 直角三角形 |
ユーザー |
|
提出日時 | 2016-10-14 11:37:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 482 bytes |
コンパイル時間 | 601 ms |
コンパイル使用メモリ | 66,164 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 05:59:46 |
合計ジャッジ時間 | 1,344 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <iostream> #include <cstdint> #include <cmath> #include <iomanip> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int a, b; cin >> a >> b; double ans1, ans2; ans1 = sqrt(a * a + b * b); if (a == b) { ans2 = sqrt(a * a + b * b); } else if (a > b) { ans2 = sqrt(a * a - b * b); } else { ans2 = sqrt(b * b - a * a); } cout << fixed << setprecision(6) << ((ans1 < ans2) ? ans1 : ans2) << endl; return 0; }