結果

問題 No.419 直角三角形
ユーザー uafr_csuafr_cs
提出日時 2016-09-09 22:24:28
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,571 bytes
コンパイル時間 1,884 ms
コンパイル使用メモリ 78,700 KB
実行使用メモリ 41,248 KB
最終ジャッジ日時 2024-04-28 01:04:23
合計ジャッジ時間 4,981 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
40,888 KB
testcase_01 AC 95 ms
40,588 KB
testcase_02 AC 97 ms
40,792 KB
testcase_03 AC 95 ms
40,896 KB
testcase_04 AC 84 ms
39,468 KB
testcase_05 AC 98 ms
40,996 KB
testcase_06 AC 100 ms
40,784 KB
testcase_07 AC 90 ms
40,352 KB
testcase_08 WA -
testcase_09 AC 96 ms
40,776 KB
testcase_10 AC 94 ms
40,348 KB
testcase_11 AC 98 ms
39,968 KB
testcase_12 WA -
testcase_13 AC 106 ms
40,704 KB
testcase_14 AC 112 ms
40,984 KB
testcase_15 AC 104 ms
40,752 KB
testcase_16 AC 88 ms
39,948 KB
testcase_17 AC 92 ms
40,056 KB
testcase_18 AC 92 ms
39,964 KB
testcase_19 AC 98 ms
40,912 KB
testcase_20 AC 86 ms
39,840 KB
testcase_21 AC 93 ms
39,936 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int a = sc.nextInt();
		final int b = sc.nextInt();
		
		final int max = Math.max(a, b);
		final int min = Math.min(a, b);
		
		System.out.printf("%.8f\n", Math.min(Math.sqrt(max * max - min * min), Math.sqrt(max * max + min * min)));
	}
	
	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;
 
		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}	
 
		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}
 
		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}
 
		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public void close() throws IOException {
			br.close();
		}
	}
}
0