結果

問題 No.112 ややこしい鶴亀算
ユーザー qwrtpsfg
提出日時 2017-09-01 21:30:54
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,007 bytes
コンパイル時間 1,123 ms
コンパイル使用メモリ 111,968 KB
実行使用メモリ 27,484 KB
最終ジャッジ日時 2024-11-06 17:29:50
合計ジャッジ時間 2,568 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;
using System.Linq;

public class yukicoder
{
    public static bool issame(int[] n)
    {
        for(int i = 1; i <= n.Length - 1; i++)
        {
            if(n[0] != n[i])
            {
                return false;
            }
        }
        return true;
    }
    
    public static void Main()
    {
        int animals = int.Parse(Console.ReadLine());
        int[] input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        int t = 0;
        int k = 0;
        
        if(issame(input))
        {
            if(input.Sum() / 2 / animals == 2)
            {
                t = animals;
            }
            else
            {
                k = animals;
            }
        }
        else
        {
            Array.Sort(input);
            t = input.Length - Array.IndexOf(input, input.Max());
            k = input.Length - t;
        }
        
        Console.WriteLine("{0} {1}", t, k);
        
    }
}
0