結果
問題 |
No.419 直角三角形
|
ユーザー |
![]() |
提出日時 | 2024-07-27 11:52:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 574 bytes |
コンパイル時間 | 1,736 ms |
コンパイル使用メモリ | 166,128 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-27 11:52:57 |
合計ジャッジ時間 | 3,204 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,m,n) for(int i=m; i<n; ++i) #define repl(i,m,n) for(ll i=m; i<n; ++i) int main(){ int a, b; cin >> a >> b; if(a == b){ double ans = sqrt(2.0)*double(a); printf("%.10f\n", ans); }else{ if(a < b) swap(a, b); double ans = 1e9; ans = min(ans, double(sqrt(double(a)*double(a) + double(b)*double(b)))); ans = min(ans, double(sqrt(double(a)*double(a) - double(b)*double(b)))); printf("%.10f\n", ans); } return 0; }