結果

問題 No.112 ややこしい鶴亀算
ユーザー Mcpu3Mcpu3
提出日時 2018-09-02 18:13:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 156 ms / 5,000 ms
コード長 457 bytes
コンパイル時間 1,927 ms
コンパイル使用メモリ 76,100 KB
実行使用メモリ 56,812 KB
最終ジャッジ日時 2024-04-09 20:48:05
合計ジャッジ時間 6,435 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
55,052 KB
testcase_01 AC 138 ms
54,744 KB
testcase_02 AC 134 ms
54,844 KB
testcase_03 AC 142 ms
55,148 KB
testcase_04 AC 133 ms
54,724 KB
testcase_05 AC 142 ms
54,944 KB
testcase_06 AC 136 ms
54,832 KB
testcase_07 AC 136 ms
54,632 KB
testcase_08 AC 156 ms
54,900 KB
testcase_09 AC 149 ms
54,960 KB
testcase_10 AC 135 ms
56,812 KB
testcase_11 AC 140 ms
54,892 KB
testcase_12 AC 127 ms
54,504 KB
testcase_13 AC 129 ms
54,420 KB
testcase_14 AC 135 ms
54,432 KB
testcase_15 AC 156 ms
54,908 KB
testcase_16 AC 151 ms
54,468 KB
testcase_17 AC 140 ms
54,916 KB
testcase_18 AC 149 ms
54,952 KB
testcase_19 AC 135 ms
54,436 KB
testcase_20 AC 136 ms
54,732 KB
testcase_21 AC 134 ms
54,596 KB
testcase_22 AC 127 ms
54,828 KB
testcase_23 AC 140 ms
55,044 KB
testcase_24 AC 134 ms
54,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt(),a[]=new int[50],m=0,s1=0,s2=0,t=0,i;
		for(i=0;i<n;i++) {
			a[i]=sc.nextInt();
			if(a[i]>m) m=a[i];
			if(i>0&&a[i-1]!=a[i]) t++;
		}
		sc.close();
		for(i=0;i<n;i++) {
			if(m>a[i]) s2++;
			else s1++;
		}
		if(1>t&&m/(n-1)>2) System.out.print(s2+" "+s1);
		else System.out.print(s1+" "+s2);
	}
}
0