結果

問題 No.112 ややこしい鶴亀算
ユーザー qwrtpsfg
提出日時 2017-09-01 21:32:26
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,007 bytes
コンパイル時間 976 ms
コンパイル使用メモリ 106,752 KB
実行使用メモリ 19,456 KB
最終ジャッジ日時 2024-11-06 17:29:58
合計ジャッジ時間 2,551 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 19 WA * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
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)
            {
                k = animals;
            }
            else
            {
                t = animals;
            }
        }
        else
        {
            Array.Sort(input);
            t = input.Length - Array.IndexOf(input, input.Max());
            k = input.Length - t;
        }
        
        Console.WriteLine("{0} {1}", t, k);
        
    }
}
0