結果
| 問題 |
No.419 直角三角形
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-14 17:31:27 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 501 bytes |
| コンパイル時間 | 1,181 ms |
| コンパイル使用メモリ | 89,464 KB |
| 最終ジャッジ日時 | 2025-01-09 18:47:00 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <iomanip>
#include <cmath>
using ldouble = long double;
void solve() {
ldouble a, b;
std::cin >> a >> b;
ldouble c;
if (a == b) {
c = std::sqrt(2L) * a;
} else {
if (a > b) std::swap(a, b);
c = std::sqrt(b * b - a * a);
}
std::cout << std::fixed << std::setprecision(10)
<< c << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}