結果

問題 No.112 ややこしい鶴亀算
ユーザー qwrtpsfgqwrtpsfg
提出日時 2017-09-01 21:30:54
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,007 bytes
コンパイル時間 810 ms
コンパイル使用メモリ 107,264 KB
実行使用メモリ 19,328 KB
最終ジャッジ日時 2024-04-24 09:59:16
合計ジャッジ時間 2,262 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
19,200 KB
testcase_01 AC 25 ms
19,072 KB
testcase_02 AC 26 ms
19,072 KB
testcase_03 AC 26 ms
19,200 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 26 ms
19,328 KB
testcase_07 AC 25 ms
19,200 KB
testcase_08 AC 23 ms
19,072 KB
testcase_09 WA -
testcase_10 AC 26 ms
19,200 KB
testcase_11 AC 25 ms
19,072 KB
testcase_12 AC 25 ms
19,328 KB
testcase_13 AC 24 ms
18,688 KB
testcase_14 WA -
testcase_15 AC 28 ms
19,328 KB
testcase_16 AC 29 ms
19,200 KB
testcase_17 AC 29 ms
19,200 KB
testcase_18 AC 28 ms
19,328 KB
testcase_19 AC 27 ms
19,072 KB
testcase_20 WA -
testcase_21 AC 29 ms
19,328 KB
testcase_22 AC 29 ms
19,072 KB
testcase_23 AC 29 ms
19,200 KB
testcase_24 AC 27 ms
19,072 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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