結果

問題 No.1904 Never giving up!
ユーザー masayamatumasayamatu
提出日時 2022-06-23 21:11:44
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 1,153 bytes
コンパイル時間 10,382 ms
コンパイル使用メモリ 167,940 KB
実行使用メモリ 184,832 KB
最終ジャッジ日時 2024-04-25 04:38:06
合計ジャッジ時間 11,713 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
30,312 KB
testcase_01 AC 56 ms
29,952 KB
testcase_02 AC 56 ms
29,952 KB
testcase_03 AC 55 ms
30,080 KB
testcase_04 AC 56 ms
29,824 KB
testcase_05 AC 54 ms
30,208 KB
testcase_06 AC 54 ms
30,080 KB
testcase_07 AC 54 ms
29,824 KB
testcase_08 AC 56 ms
29,952 KB
testcase_09 AC 56 ms
29,824 KB
testcase_10 AC 55 ms
30,208 KB
testcase_11 AC 55 ms
184,832 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (111 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 long[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 (long j = 1; j <= list[i]; j++)
                    {
                        p *= j;
                    }
                }
            }
            Console.WriteLine(all / p);
        }
    }
}
0