結果
問題 | No.419 直角三角形 |
ユーザー |
|
提出日時 | 2016-09-27 13:02:30 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 127 ms / 1,000 ms |
コード長 | 411 bytes |
コンパイル時間 | 1,889 ms |
コンパイル使用メモリ | 73,984 KB |
実行使用メモリ | 56,116 KB |
最終ジャッジ日時 | 2024-11-21 07:15:39 |
合計ジャッジ時間 | 5,552 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int a = scn.nextInt(); int b = scn.nextInt(); if(a == b){ double ans = Math.sqrt(a*a+b*b); System.out.println(ans); }else{ if(a<b){ int sub = a; a = b; b = sub; } double ans = Math.sqrt(a*a-b*b); System.out.println(ans); } } }