結果
問題 | No.419 直角三角形 |
ユーザー | tenten |
提出日時 | 2022-08-01 19:28:35 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 42 ms / 1,000 ms |
コード長 | 1,128 bytes |
コンパイル時間 | 2,289 ms |
コンパイル使用メモリ | 74,388 KB |
実行使用メモリ | 49,960 KB |
最終ジャッジ日時 | 2023-09-29 16:14:58 |
合計ジャッジ時間 | 4,694 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
49,400 KB |
testcase_01 | AC | 36 ms
49,216 KB |
testcase_02 | AC | 38 ms
49,432 KB |
testcase_03 | AC | 40 ms
49,748 KB |
testcase_04 | AC | 38 ms
49,376 KB |
testcase_05 | AC | 37 ms
49,608 KB |
testcase_06 | AC | 38 ms
49,252 KB |
testcase_07 | AC | 38 ms
49,300 KB |
testcase_08 | AC | 38 ms
49,320 KB |
testcase_09 | AC | 39 ms
49,224 KB |
testcase_10 | AC | 38 ms
49,720 KB |
testcase_11 | AC | 37 ms
49,960 KB |
testcase_12 | AC | 37 ms
49,844 KB |
testcase_13 | AC | 37 ms
49,820 KB |
testcase_14 | AC | 37 ms
49,156 KB |
testcase_15 | AC | 38 ms
49,224 KB |
testcase_16 | AC | 39 ms
49,304 KB |
testcase_17 | AC | 42 ms
49,220 KB |
testcase_18 | AC | 40 ms
49,624 KB |
testcase_19 | AC | 38 ms
49,288 KB |
testcase_20 | AC | 41 ms
47,512 KB |
testcase_21 | AC | 40 ms
49,240 KB |
testcase_22 | AC | 39 ms
49,336 KB |
ソースコード
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int a = sc.nextInt(); int b = sc.nextInt(); if (a == b) { System.out.println(Math.sqrt(Math.pow(a, 2) * 2)); } else { System.out.println(Math.sqrt(Math.pow(Math.max(a, b), 2) - Math.pow(Math.min(a, b), 2))); } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }