結果
問題 |
No.419 直角三角形
|
ユーザー |
![]() |
提出日時 | 2016-09-22 15:01:15 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 33 ms / 1,000 ms |
コード長 | 711 bytes |
コンパイル時間 | 719 ms |
コンパイル使用メモリ | 111,772 KB |
実行使用メモリ | 28,300 KB |
最終ジャッジ日時 | 2024-11-17 13:08:29 |
合計ジャッジ時間 | 2,175 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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)); } }