結果
問題 | No.1586 Equal Array |
ユーザー | masakunm |
提出日時 | 2021-07-08 22:25:22 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,985 bytes |
コンパイル時間 | 2,907 ms |
コンパイル使用メモリ | 110,592 KB |
実行使用メモリ | 32,896 KB |
最終ジャッジ日時 | 2024-07-01 12:45:58 |
合計ジャッジ時間 | 4,930 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 25 ms
17,920 KB |
testcase_01 | AC | 25 ms
17,664 KB |
testcase_02 | AC | 24 ms
17,920 KB |
testcase_03 | AC | 25 ms
18,048 KB |
testcase_04 | AC | 56 ms
24,112 KB |
testcase_05 | AC | 55 ms
23,968 KB |
testcase_06 | AC | 72 ms
27,520 KB |
testcase_07 | AC | 71 ms
27,392 KB |
testcase_08 | AC | 71 ms
27,648 KB |
testcase_09 | AC | 73 ms
27,520 KB |
testcase_10 | AC | 71 ms
27,776 KB |
testcase_11 | AC | 24 ms
17,664 KB |
testcase_12 | AC | 24 ms
18,048 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 24 ms
17,792 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 25 ms
17,920 KB |
testcase_21 | AC | 25 ms
18,048 KB |
testcase_22 | AC | 24 ms
17,792 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; using System.Collections.Generic; using System.Text; namespace Main { class Program { static void Main(string[] args) { int N = ReadInt1(); int[] Ary = ReadIntAry(); int sum = 0; for (int i = 0; i < N; i++) { sum += Ary[i]; } Console.WriteLine((sum % N == 0) ? "Yes" : "No"); } public static int Lcm(int a, int b) { return a * b / Gcd(a, b); } public static int Gcd(int a, int b) { if (a < b) return Gcd(b, a); while (b != 0) { var remainder = a % b; a = b; b = remainder; } return a; } static void AddValue2Dic(ref Dictionary<string, int> dic, string key, int val) { if (!dic.ContainsKey(key)) dic.Add(key, val); else dic[key] += val; } static void AddValue2Dic(ref Dictionary<int, int> dic, int key, int val) { if (!dic.ContainsKey(key)) dic.Add(key, val); else dic[key] += val; } static long[] ReadLongAry() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse); static long ReadLong1() { return long.Parse(Console.ReadLine()); } static (long, long) ReadLong2() { var x = ReadLongAry(); return (x[0], x[1]); } static (long, long, long) ReadLong3() { var x = ReadLongAry(); return (x[0], x[1], x[2]); } static int[] ReadIntAry() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse); static int ReadInt1() { return int.Parse(Console.ReadLine()); } static (int, int) ReadInt2() { var x = ReadIntAry(); return (x[0], x[1]); } static (int, int, int) ReadInt3() { var x = ReadIntAry(); return (x[0], x[1], x[2]); } static string[] ReadStrAry() => Console.ReadLine().Split(); static string ReadStr1() { return Console.ReadLine(); } static (string, string) ReadStr2() { var x = ReadStrAry(); return (x[0], x[1]); } static (string, string, string) ReadStr3() { var x = ReadStrAry(); return (x[0], x[1], x[2]); } } public static class Combination { public static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items, int k, bool withRepetition) { if (k == 1) { foreach (var item in items) yield return new T[] { item }; yield break; } foreach (var item in items) { var leftside = new T[] { item }; var unused = withRepetition ? items : items.SkipWhile(e => !e.Equals(item)).Skip(1).ToList(); foreach (var rightside in Enumerate(unused, k - 1, withRepetition)) { yield return leftside.Concat(rightside).ToArray(); } } } } }