結果

問題 No.419 直角三角形
ユーザー 👑 obakyan
提出日時 2019-03-22 11:48:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 423 bytes
コンパイル時間 793 ms
コンパイル使用メモリ 71,656 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-19 02:21:25
合計ジャッジ時間 1,408 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>

int main()
{
    int a, b;
    std::cin >> a >> b;
    double c;
    if(a == b){
        c = std::sqrt(2) * a;
    } else {
        c = a < b ? std::sqrt(b * b - a * a) : std::sqrt(a * a - b * b);
    }
    std::cout << std::fixed << std::setprecision(6) << c << std::endl;
    return 0;
}
0