結果

問題 No.419 直角三角形
ユーザー hkr
提出日時 2017-02-19 17:59:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 391 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 66,168 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 05:12:30
合計ジャッジ時間 1,757 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main() {
    double a, b;
    double ans;
    cin >> a >> b;
    if(a==b)
        ans = sqrt(a * a * 2);
    else {
        if(b > a) {
            double temp = a;
            a = b;
            b = temp;
        }
        ans = sqrt(a*a - b*b);
    }
    cout << fixed << setprecision(6) << ans << endl;
}
0