結果
問題 |
No.419 直角三角形
|
ユーザー |
|
提出日時 | 2024-12-11 17:54:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 512 bytes |
コンパイル時間 | 819 ms |
コンパイル使用メモリ | 89,652 KB |
最終ジャッジ日時 | 2025-02-26 12:01:31 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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); int16_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; }