結果

問題 No.419 直角三角形
ユーザー uafr_csuafr_cs
提出日時 2016-09-09 22:25:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 118 ms / 1,000 ms
コード長 1,669 bytes
コンパイル時間 3,524 ms
コンパイル使用メモリ 75,312 KB
実行使用メモリ 56,224 KB
最終ジャッジ日時 2023-08-10 08:07:17
合計ジャッジ時間 6,370 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,428 KB
testcase_01 AC 117 ms
55,768 KB
testcase_02 AC 118 ms
55,484 KB
testcase_03 AC 117 ms
55,740 KB
testcase_04 AC 118 ms
55,516 KB
testcase_05 AC 118 ms
56,088 KB
testcase_06 AC 117 ms
55,600 KB
testcase_07 AC 117 ms
55,776 KB
testcase_08 AC 117 ms
56,128 KB
testcase_09 AC 117 ms
55,964 KB
testcase_10 AC 117 ms
55,960 KB
testcase_11 AC 118 ms
56,212 KB
testcase_12 AC 116 ms
56,224 KB
testcase_13 AC 117 ms
55,912 KB
testcase_14 AC 118 ms
56,012 KB
testcase_15 AC 118 ms
55,484 KB
testcase_16 AC 117 ms
56,084 KB
testcase_17 AC 116 ms
56,008 KB
testcase_18 AC 116 ms
55,776 KB
testcase_19 AC 117 ms
55,956 KB
testcase_20 AC 118 ms
55,748 KB
testcase_21 AC 116 ms
55,776 KB
testcase_22 AC 117 ms
55,932 KB
権限があれば一括ダウンロードができます

ソースコード

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);
		
		if(max == min){
			System.out.printf("%.8f\n", Math.sqrt(max * max + min * min));
		}else{
			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