結果

問題 No.998 Four Integers
ユーザー TD
提出日時 2022-06-08 13:06:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 26 ms / 1,000 ms
コード長 791 bytes
コンパイル時間 849 ms
コンパイル使用メモリ 110,156 KB
実行使用メモリ 26,320 KB
最終ジャッジ日時 2024-09-21 05:04:52
合計ジャッジ時間 2,263 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int[] a = new int[s.Length];
            int count = 0;
            for(int i=0; i < s.Length; i++)
            {
                a[i] = int.Parse(s[i]);
            }
            Array.Sort(a);
            for(int x = 0; x < s.Length-1; x++)
            {
                if (a[x]+1==a[x+1])
                {
                    count++;
                }
            }

            if (count == s.Length - 1)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }

            
            
        }
    }
}
0