結果
問題 | No.419 直角三角形 |
ユーザー |
![]() |
提出日時 | 2019-11-19 23:45:19 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 122 ms / 1,000 ms |
コード長 | 392 bytes |
コンパイル時間 | 1,883 ms |
コンパイル使用メモリ | 74,516 KB |
実行使用メモリ | 54,264 KB |
最終ジャッジ日時 | 2024-10-04 14:21:21 |
合計ジャッジ時間 | 5,250 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) throws Exception { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); if (a == b) { System.out.println(Math.sqrt(a * a + b * b)); return; } int max = Math.max(a, b); int min = Math.min(a, b); System.out.println(Math.sqrt(max * max - min * min)); } }