結果

問題 No.118 門松列(2)
ユーザー 14番14番
提出日時 2016-04-17 04:54:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 80 ms / 5,000 ms
コード長 2,258 bytes
コンパイル時間 3,772 ms
コンパイル使用メモリ 112,368 KB
実行使用メモリ 24,192 KB
最終ジャッジ日時 2024-04-17 14:10:41
合計ジャッジ時間 4,987 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
18,816 KB
testcase_01 AC 78 ms
23,936 KB
testcase_02 AC 78 ms
23,668 KB
testcase_03 AC 80 ms
23,876 KB
testcase_04 AC 79 ms
23,944 KB
testcase_05 AC 75 ms
24,192 KB
testcase_06 AC 25 ms
18,176 KB
testcase_07 AC 24 ms
18,432 KB
testcase_08 AC 25 ms
18,048 KB
testcase_09 AC 73 ms
23,764 KB
testcase_10 AC 52 ms
19,584 KB
testcase_11 AC 55 ms
20,096 KB
testcase_12 AC 53 ms
19,584 KB
testcase_13 AC 50 ms
19,072 KB
testcase_14 AC 74 ms
23,564 KB
testcase_15 AC 49 ms
18,688 KB
testcase_16 AC 63 ms
21,760 KB
testcase_17 AC 50 ms
18,944 KB
testcase_18 AC 56 ms
19,968 KB
testcase_19 AC 61 ms
21,376 KB
testcase_20 AC 60 ms
21,632 KB
testcase_21 AC 71 ms
22,912 KB
testcase_22 AC 55 ms
19,584 KB
testcase_23 AC 69 ms
22,400 KB
testcase_24 AC 57 ms
20,224 KB
testcase_25 AC 59 ms
20,648 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.Text;
using System.Linq;
 
class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int itemCount = int.Parse(Reader.ReadLine());
        int[] list = Reader.GetInt();
        Dictionary<int, int> dic = new Dictionary<int, int>();
        for(int i=0; i<list.Length; i++) {
            int num = list[i];
            if(!dic.ContainsKey(num)) {
                dic.Add(num, 1);
            } else
            {
                dic[num]++;
            }
        }
        long ans = 0;
        long modNum = 1000000000 + 7;
        List<int> keyList = new List<int>(dic.Keys);
        for(int i=0; i<keyList.Count-2; i++) {
            for(int j=i+1; j<keyList.Count - 1; j++) {
                for(int k=j+1; k<keyList.Count; k++) {
                    long tmp = (dic[keyList[i]] * dic[keyList[j]]) % modNum;
                    tmp = (tmp * dic[keyList[k]]) % modNum;
                    ans += tmp;
                    ans = ans % modNum;
                }
            }
        }
        Console.WriteLine(ans);
    }
 
 
 
    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"






 
";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        public static int[] GetInt(char delimiter = ' ', bool trim = false)
        {
            string inptStr = ReadLine();
            if (trim)
            {
                inptStr = inptStr.Trim();
            }
            string[] inpt = inptStr.Split(delimiter);
            int[] ret = new int[inpt.Length];
            for (int i = 0; i < inpt.Length; i++)
            {
                ret[i] = int.Parse(inpt[i]);
            }
            return ret;
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0