結果

問題 No.73 helloworld
ユーザー bluemeganebluemegane
提出日時 2018-10-30 15:12:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 5,000 ms
コード長 1,002 bytes
コンパイル時間 2,143 ms
コンパイル使用メモリ 103,880 KB
実行使用メモリ 22,836 KB
最終ジャッジ日時 2023-09-13 20:32:41
合計ジャッジ時間 3,766 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
20,696 KB
testcase_01 AC 60 ms
20,812 KB
testcase_02 AC 58 ms
20,756 KB
testcase_03 AC 59 ms
20,908 KB
testcase_04 AC 58 ms
20,664 KB
testcase_05 AC 58 ms
22,836 KB
testcase_06 AC 58 ms
20,800 KB
testcase_07 AC 58 ms
20,756 KB
testcase_08 AC 59 ms
20,664 KB
testcase_09 AC 59 ms
20,868 KB
testcase_10 AC 59 ms
20,816 KB
testcase_11 AC 59 ms
20,792 KB
testcase_12 AC 59 ms
20,812 KB
testcase_13 AC 58 ms
20,712 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Collections.Generic;
using static System.Math;
using System;

public class Hello
{
     static void Main()
    {
        var ap = "abcdefghijklmnopqrstuvwxyz";
        var d = new Dictionary<char, int>();
        for (int i = 0; i < 26; i++)
           d[ap[i]] = int.Parse(Console.ReadLine().Trim());
        var hw = "hewrd";
        var ans = 1L;
        foreach (var x in hw)
            ans *= d[x];
        ans *= getL(d['l']);
        ans *= getO(d['o']);
        Console.WriteLine(ans);
    }
    static int getO (int n)
    {
        if (n < 2) return 0;
        var ans = 0;
        for (int i = 1; i <= n - 1; i++)
        {
            var w = i * (n - i);
            ans = Max(ans, w);
        }
        return ans;
    }
    static int getL (int n)
    {
        if (n < 3) return 0;
        var ans = 0;
        for (int i = 2; i <= n -1; i++)
        {
            var w = (i * (i - 1)) / 2 * (n - i);
            ans = Max(ans, w);
        }
        return ans;
    }
}

0