結果

問題 No.669 対決!!! 飲み比べ
ユーザー No
提出日時 2018-03-31 00:26:56
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,026 bytes
コンパイル時間 885 ms
コンパイル使用メモリ 114,064 KB
実行使用メモリ 29,460 KB
最終ジャッジ日時 2024-06-26 01:03:15
合計ジャッジ時間 2,705 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 15 WA * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

namespace y
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split();
            int n = int.Parse(ss[0]);
            int k = int.Parse(ss[1]);
            var a = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

            int z = a.Count(x => x == 0);
            int w = 0;
            int l = z;

            foreach (var item in a)
            {
                if (item == 0) continue;
                if (item % (k + 1) == 0)
                {
                    l++;
                }
                else
                {
                    w++;
                }
            }

            if (w == 1)
            {
                Console.WriteLine("YES");
            }
            else if (w != 0 && l % 2 == 1)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}
0