結果

問題 No.2451 Redistribute Integers
ユーザー viral8
提出日時 2023-09-01 21:33:39
言語 Java
(openjdk 23)
結果
AC  
実行時間 1,172 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 2,315 ms
コンパイル使用メモリ 74,104 KB
実行使用メモリ 59,868 KB
最終ジャッジ日時 2024-06-11 11:00:36
合計ジャッジ時間 16,074 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] A = new int[N];
		long sum = 0;
		int min = Integer.MAX_VALUE;
		for(int i=0;i<N;i++){
			sum += A[i] = sc.nextInt();
			min = Math.min(A[i],min);
		}
		if(sum%N>0){
			System.out.println("No");
			return;
		}
		for(int num:A){
			if((num-min)%N>0){
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}
0