結果

問題 No.73 helloworld
ユーザー bluemeganebluemegane
提出日時 2018-10-30 15:24:47
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 57 ms / 5,000 ms
コード長 1,088 bytes
コンパイル時間 2,111 ms
コンパイル使用メモリ 104,296 KB
実行使用メモリ 22,840 KB
最終ジャッジ日時 2023-09-13 20:33:04
合計ジャッジ時間 3,513 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
20,700 KB
testcase_01 AC 56 ms
20,788 KB
testcase_02 AC 56 ms
20,776 KB
testcase_03 AC 56 ms
20,720 KB
testcase_04 AC 55 ms
20,780 KB
testcase_05 AC 57 ms
22,840 KB
testcase_06 AC 56 ms
20,736 KB
testcase_07 AC 55 ms
20,700 KB
testcase_08 AC 56 ms
20,664 KB
testcase_09 AC 56 ms
20,704 KB
testcase_10 AC 56 ms
18,684 KB
testcase_11 AC 56 ms
22,832 KB
testcase_12 AC 55 ms
20,752 KB
testcase_13 AC 55 ms
20,704 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];
            if (ans == 0) { Console.WriteLine(0); goto exit; }
        }
        ans *= getL(d['l']);
        if (ans == 0) { Console.WriteLine(0); goto exit; }
        ans *= getO(d['o']);
        if (ans == 0) { Console.WriteLine(0); goto exit; }
        Console.WriteLine(ans);
        exit:;
    }
    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