結果

問題 No.73 helloworld
ユーザー 14番14番
提出日時 2017-06-22 01:15:05
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 63 ms / 5,000 ms
コード長 1,927 bytes
コンパイル時間 4,335 ms
コンパイル使用メモリ 105,676 KB
実行使用メモリ 23,728 KB
最終ジャッジ日時 2023-09-12 13:07:51
合計ジャッジ時間 6,102 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,744 KB
testcase_01 AC 62 ms
23,728 KB
testcase_02 AC 62 ms
21,608 KB
testcase_03 AC 62 ms
21,592 KB
testcase_04 AC 63 ms
21,632 KB
testcase_05 AC 62 ms
21,652 KB
testcase_06 AC 62 ms
21,784 KB
testcase_07 AC 62 ms
21,728 KB
testcase_08 AC 62 ms
21,724 KB
testcase_09 AC 62 ms
21,620 KB
testcase_10 AC 62 ms
21,592 KB
testcase_11 AC 63 ms
21,700 KB
testcase_12 AC 62 ms
21,680 KB
testcase_13 AC 61 ms
21,600 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.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        Dictionary<char, int> cnt = new Dictionary<char, int>();
        for (char c = 'a'; c <= 'z'; c++) {
            cnt.Add(c, int.Parse(Reader.ReadLine()));
        }

        string word = string.Join(string.Empty, "helloworld".Distinct());
        long ans = 1;
        for (int i = 0; i < word.Length; i++) {
            if(word[i] == 'l') {
                if(cnt[word[i]]<3) {
                    ans = 0;
                    break;
                }
                long tmp = cnt[word[i]] - 3;
                long tmp2 = 1;
                for (int j = 1; j <= tmp; j++) {
                    long l1 = 2 + j;
                    long l2 = 1 + tmp - j;
                    long l3 = 2 + tmp - j;
                    long l4 = 1 + j;
                    tmp2 = Math.Max(tmp2, l1 * (l1 - 1) / 2 * l2);
                    tmp2 = Math.Max(tmp2, l3 * (l3 - 1) / 2 * l4);
                }
                ans = ans * tmp2;
            } else if(word[i]=='o') {
                long tmp = cnt[word[i]] / 2 * (cnt[word[i]] - cnt[word[i]] / 2);
                ans = ans * tmp;
            } else {
                ans = ans * (cnt[word[i]]);
            }
        }
        Console.WriteLine(ans);
    }




	public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"


0
0
0
1
1
0
0
1
0
0
0
4
0
0
3
0
0
1
0
0
0
0
1
0
0
0


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}
0