結果

問題 No.419 直角三角形
ユーザー noriocnorioc
提出日時 2016-09-22 15:01:15
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 66 ms / 1,000 ms
コード長 711 bytes
コンパイル時間 3,890 ms
コンパイル使用メモリ 104,420 KB
実行使用メモリ 25,952 KB
最終ジャッジ日時 2023-08-11 01:16:32
合計ジャッジ時間 5,565 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
23,860 KB
testcase_01 AC 63 ms
23,856 KB
testcase_02 AC 65 ms
23,804 KB
testcase_03 AC 65 ms
23,816 KB
testcase_04 AC 66 ms
25,952 KB
testcase_05 AC 66 ms
25,816 KB
testcase_06 AC 66 ms
23,800 KB
testcase_07 AC 66 ms
25,888 KB
testcase_08 AC 65 ms
23,876 KB
testcase_09 AC 66 ms
25,864 KB
testcase_10 AC 65 ms
25,936 KB
testcase_11 AC 65 ms
23,920 KB
testcase_12 AC 65 ms
21,684 KB
testcase_13 AC 66 ms
25,832 KB
testcase_14 AC 65 ms
23,864 KB
testcase_15 AC 65 ms
23,904 KB
testcase_16 AC 64 ms
23,824 KB
testcase_17 AC 65 ms
23,856 KB
testcase_18 AC 65 ms
23,868 KB
testcase_19 AC 65 ms
25,856 KB
testcase_20 AC 64 ms
23,860 KB
testcase_21 AC 65 ms
23,916 KB
testcase_22 AC 65 ms
25,708 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static double Calc(int a, int b) {
        if (a > b) return Calc(b, a);

        var x = Math.Sqrt(a * a + b * b);
        if (a < b) {
            var y = Math.Sqrt(b * b - a * a);
            return Math.Min(x, y);
        }
        return x;
    }

    static void Main() {
        var ab = ReadInts();
        int a = ab[0], b = ab[1];
        Console.WriteLine(Calc(a, b));
    }
}
0