結果
| 問題 |
No.609 Noelちゃんと星々
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-14 01:21:05 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 467 bytes |
| コンパイル時間 | 3,483 ms |
| コンパイル使用メモリ | 74,984 KB |
| 実行使用メモリ | 61,084 KB |
| 最終ジャッジ日時 | 2024-06-30 14:17:26 |
| 合計ジャッジ時間 | 19,314 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 25 |
ソースコード
import java.util.*;
public class No609{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long[] Y = new long[N];
long sum = 0;
for(int i = 0; i < N; i++){
Y[i] = sc.nextLong();
sum += Y[i];
}
long mean;
if(sum%N > 0){
mean = sum/N + 1;
}else{
mean = sum/N;
}
long diff = 0;
for(int i = 0; i < N; i++){
diff += Math.abs(mean - Y[i]);
}
System.out.println(diff);
}
}