結果
| 問題 | 
                            No.1285 ゴミ捨て
                             | 
                    
| コンテスト | |
| ユーザー | 
                             bluemegane
                         | 
                    
| 提出日時 | 2020-11-14 06:55:08 | 
| 言語 | C#(csc)  (csc 3.9.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 93 ms / 2,000 ms | 
| コード長 | 496 bytes | 
| コンパイル時間 | 2,571 ms | 
| コンパイル使用メモリ | 103,808 KB | 
| 実行使用メモリ | 22,036 KB | 
| 最終ジャッジ日時 | 2024-11-28 21:51:33 | 
| 合計ジャッジ時間 | 4,753 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 22 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var a = new int[n];
        for (int i = 0; i < n; i++) a[i] = int.Parse(Console.ReadLine().Trim());
        getAns(n, a);
    }
    static void getAns (int n, int[] a)
    {
        Array.Sort(a);
        var count = 0;
        for (int i = 0; i < n-1; i++)
            if (a[i + 1] - a[i] == 1) { Console.WriteLine(2); return; }
        Console.WriteLine(1);
    }
}
            
            
            
        
            
bluemegane