結果
問題 | No.476 正しくない平均 |
ユーザー |
|
提出日時 | 2017-10-02 01:17:43 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 53 ms / 2,000 ms |
コード長 | 782 bytes |
コンパイル時間 | 4,125 ms |
コンパイル使用メモリ | 73,208 KB |
実行使用メモリ | 37,364 KB |
最終ジャッジ日時 | 2024-11-15 21:52:42 |
合計ジャッジ時間 | 6,107 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No476 { public static void main(String[] args) { try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] str = br.readLine().split(" "); int N = Integer.parseInt(str[0]); double maiAns = Double.parseDouble(str[1]); String[] str2 = br.readLine().split(" "); long[] num = new long[N]; long sum = 0; for(int i=0; i < N; i++){ num[i] = Integer.parseInt(str2[i]); sum += num[i]; } double ave = (double)sum / N; if(maiAns == ave) System.out.println("YES"); else System.out.println("NO"); }catch(IOException e){ e.getStackTrace(); }catch(NumberFormatException e){ e.getStackTrace(); } } }