AtCoder Regular Contest 004

Submission #23088

Source codeソースコード

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int p[][]=new int[n][2];
		for(int i=0;i<n;i++){
			p[i][0]=sc.nextInt();
			p[i][1]=sc.nextInt();
		}
		double ans=0;
		for(int i=0;i<n;i++){
			for(int j=i+1;j<n;j++){
				ans=Math.max(ans, Math.sqrt(Math.pow(p[i][0]-p[j][0], 2)+Math.pow(p[i][1]-p[j][1], 2)));
			}
		}
		System.out.println(ans);
	}
}

Submission

Task問題 A - 2点間距離の最大値 ( The longest distance )
User nameユーザ名 hoshi524
Created time投稿日時
Language言語 Java (OpenJDK 1.7.0)
Status状態 AC
Score得点 100
Source lengthソースコード長 474 Byte
File nameファイル名
Exec time実行時間 669 ms
Memory usageメモリ使用量 22108 KB

Test case

Set

Set name Score得点 / Max score Cases
All 100 / 100 00_max.txt,00_sample_01.txt,00_sample_02.txt,00_sample_03.txt,00_sample_04.txt,00_sample_05.txt,01_rnd_00.txt,01_rnd_01.txt,01_rnd_02.txt,01_rnd_03.txt,01_rnd_04.txt,01_rnd_05.txt,01_rnd_06.txt,01_rnd_07.txt,01_rnd_08.txt,01_rnd_09.txt,01_rnd_10.txt,01_rnd_11.txt,01_rnd_12.txt,01_rnd_13.txt,01_rnd_14.txt,01_rnd_15.txt,01_rnd_16.txt,01_rnd_17.txt,01_rnd_18.txt,01_rnd_19.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_max.txt AC 411 ms 19792 KB
00_sample_01.txt AC 459 ms 19884 KB
00_sample_02.txt AC 423 ms 19760 KB
00_sample_03.txt AC 436 ms 19788 KB
00_sample_04.txt AC 420 ms 19920 KB
00_sample_05.txt AC 402 ms 19816 KB
01_rnd_00.txt AC 443 ms 22064 KB
01_rnd_01.txt AC 463 ms 21848 KB
01_rnd_02.txt AC 669 ms 21940 KB
01_rnd_03.txt AC 417 ms 21968 KB
01_rnd_04.txt AC 420 ms 21812 KB
01_rnd_05.txt AC 471 ms 22092 KB
01_rnd_06.txt AC 468 ms 21920 KB
01_rnd_07.txt AC 447 ms 21812 KB
01_rnd_08.txt AC 473 ms 21812 KB
01_rnd_09.txt AC 657 ms 21720 KB
01_rnd_10.txt AC 466 ms 22108 KB
01_rnd_11.txt AC 490 ms 21964 KB
01_rnd_12.txt AC 419 ms 21720 KB
01_rnd_13.txt AC 428 ms 21572 KB
01_rnd_14.txt AC 431 ms 21848 KB
01_rnd_15.txt AC 439 ms 21812 KB
01_rnd_16.txt AC 423 ms 22056 KB
01_rnd_17.txt AC 421 ms 21976 KB
01_rnd_18.txt AC 397 ms 21852 KB
01_rnd_19.txt AC 429 ms 21976 KB