結果

問題 No.419 直角三角形
ユーザー noriocnorioc
提出日時 2016-09-22 15:01:15
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 711 bytes
コンパイル時間 858 ms
コンパイル使用メモリ 110,180 KB
実行使用メモリ 28,296 KB
最終ジャッジ日時 2024-04-28 18:26:09
合計ジャッジ時間 2,428 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
25,772 KB
testcase_01 AC 31 ms
26,132 KB
testcase_02 AC 32 ms
25,900 KB
testcase_03 AC 31 ms
26,008 KB
testcase_04 AC 31 ms
26,136 KB
testcase_05 AC 31 ms
26,128 KB
testcase_06 AC 31 ms
28,176 KB
testcase_07 AC 31 ms
28,296 KB
testcase_08 AC 31 ms
26,000 KB
testcase_09 AC 31 ms
28,048 KB
testcase_10 AC 31 ms
26,264 KB
testcase_11 AC 30 ms
28,048 KB
testcase_12 AC 31 ms
26,136 KB
testcase_13 AC 31 ms
28,048 KB
testcase_14 AC 30 ms
26,012 KB
testcase_15 AC 30 ms
26,012 KB
testcase_16 AC 30 ms
26,260 KB
testcase_17 AC 31 ms
26,256 KB
testcase_18 AC 30 ms
23,988 KB
testcase_19 AC 30 ms
25,992 KB
testcase_20 AC 30 ms
28,168 KB
testcase_21 AC 31 ms
23,988 KB
testcase_22 AC 31 ms
26,140 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