結果

問題 No.73 helloworld
ユーザー 14番14番
提出日時 2017-06-22 01:15:05
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 1,927 bytes
コンパイル時間 2,607 ms
コンパイル使用メモリ 107,008 KB
実行使用メモリ 19,328 KB
最終ジャッジ日時 2024-06-30 01:27:50
合計ジャッジ時間 2,671 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
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();
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0