結果
| 問題 |
No.73 helloworld
|
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2018-10-30 15:24:47 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 5,000 ms |
| コード長 | 1,088 bytes |
| コンパイル時間 | 863 ms |
| コンパイル使用メモリ | 112,860 KB |
| 実行使用メモリ | 25,832 KB |
| 最終ジャッジ日時 | 2024-07-01 05:02:06 |
| 合計ジャッジ時間 | 1,811 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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;
}
}
bluemegane