結果
| 問題 |
No.419 直角三角形
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-12-11 17:54:30 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 512 bytes |
| コンパイル時間 | 838 ms |
| コンパイル使用メモリ | 88,560 KB |
| 最終ジャッジ日時 | 2025-02-26 12:01:34 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <iostream>
#include <iomanip>
#include <cstdint>
#include <cmath>
using namespace std;
int main()
{
cin.tie(nullptr);
ios::sync_with_stdio(false);
int32_t a, b;
cin >> a >> b;
if (a == b) cout << fixed << setprecision(10) << a * sqrt(2) << '\n';
else if (a < b) cout << fixed << setprecision(10) << sqrt(static_cast<int32_t>(b) * b - static_cast<int32_t>(a) * a);
else cout << fixed << setprecision(10) << sqrt(static_cast<int32_t>(a) * a - static_cast<int32_t>(b) * b) << '\n';
return 0;
}