結果

問題 No.112 ややこしい鶴亀算
ユーザー Mcpu3
提出日時 2018-09-02 18:13:17
言語 Java
(openjdk 23)
結果
AC  
実行時間 163 ms / 5,000 ms
コード長 457 bytes
コンパイル時間 2,255 ms
コンパイル使用メモリ 76,804 KB
実行使用メモリ 42,552 KB
最終ジャッジ日時 2024-10-01 21:11:23
合計ジャッジ時間 6,582 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

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