結果
問題 | No.419 直角三角形 |
ユーザー |
|
提出日時 | 2016-09-09 22:26:32 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 139 ms / 1,000 ms |
コード長 | 672 bytes |
コンパイル時間 | 3,295 ms |
コンパイル使用メモリ | 75,328 KB |
実行使用メモリ | 44,624 KB |
最終ジャッジ日時 | 2024-11-16 10:05:10 |
合計ジャッジ時間 | 7,205 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder419 { private static Scanner sc; private static Printer pr; private static void solve() { int a = sc.nextInt(); int b = sc.nextInt(); double c; if (a == b) { c = Math.sqrt(a * a + b * b); } else { c = Math.sqrt(Math.abs(a * a - b * b)); } pr.printf("%.7f\n", c); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }