結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,632 KB
testcase_01 AC 57 ms
20,788 KB
testcase_02 AC 55 ms
20,828 KB
testcase_03 AC 54 ms
20,724 KB
testcase_04 AC 54 ms
22,760 KB
testcase_05 AC 55 ms
22,880 KB
testcase_06 AC 54 ms
22,828 KB
testcase_07 AC 55 ms
20,836 KB
testcase_08 AC 56 ms
22,832 KB
testcase_09 AC 56 ms
22,760 KB
testcase_10 AC 57 ms
20,784 KB
testcase_11 AC 55 ms
20,696 KB
testcase_12 AC 55 ms
20,624 KB
testcase_13 AC 56 ms
22,728 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;
        return (n / 2 * (n - n / 2));
    }
    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