結果

問題 No.1904 Never giving up!
ユーザー masayamatumasayamatu
提出日時 2022-06-23 21:08:27
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,150 bytes
コンパイル時間 8,123 ms
コンパイル使用メモリ 164,816 KB
実行使用メモリ 183,368 KB
最終ジャッジ日時 2024-04-25 04:30:45
合計ジャッジ時間 9,518 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
29,952 KB
testcase_01 AC 53 ms
29,568 KB
testcase_02 AC 53 ms
29,952 KB
testcase_03 AC 54 ms
30,080 KB
testcase_04 AC 55 ms
29,696 KB
testcase_05 AC 55 ms
29,568 KB
testcase_06 WA -
testcase_07 AC 55 ms
30,080 KB
testcase_08 AC 57 ms
29,824 KB
testcase_09 AC 55 ms
29,696 KB
testcase_10 WA -
testcase_11 AC 56 ms
183,368 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (92 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
//using static CompLib.CompLib;
//using DataStructure;

namespace atcoder
{
    class Program
    {
        const int intMax = 1000000000;
        const long longMax = 2000000000000000000;
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            long all = 0;
            for (int i = 1; i <= N; i++)
            {
                if (i == 1) all = i;
                else all *= i;
            }
            var list = new int[N + 1];
            for (int i = 0; i < N; i++)
            {
                list[A[i]]++;
            }
            long p = 1;
            for (int i = 0; i < N; i++)
            {
                if (list[i] > 0)
                {
                    for (int j = 1; j <= list[i]; j++)
                    {
                        p *= j;
                    }
                }
            }
            Console.WriteLine(all / p);
        }
    }
}
0