結果
問題 | No.73 helloworld |
ユーザー |
![]() |
提出日時 | 2017-10-10 23:57:00 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 22 ms / 5,000 ms |
コード長 | 3,598 bytes |
コンパイル時間 | 855 ms |
コンパイル使用メモリ | 113,152 KB |
実行使用メモリ | 17,920 KB |
最終ジャッジ日時 | 2024-06-30 03:16:30 |
合計ジャッジ時間 | 1,836 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;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ProgrammingContest{class MainClass{Scanner sc;static void Main(string[] args){new MainClass().Solve();}void Solve(){#if DEBUGstring backPath = "..";char dirSep = System.IO.Path.DirectorySeparatorChar;string inFilePath = backPath + dirSep + backPath + dirSep + "in.txt";sc = new Scanner(new System.IO.StreamReader(inFilePath));#elsesc = new Scanner();#endifint[] cnt = new int[26];for (int i = 0; i < 26; i++){cnt[i] = sc.NextInt;}int d = 0, e = 0, h = 0, l = 0, o = 0, r = 0, w = 0;for (int i = 0; i < 26; i++){char c = (char)('a' + i);if (c == 'd') d = cnt[i];else if (c == 'e') e = cnt[i];else if (c == 'h') h = cnt[i];else if (c == 'l') l = cnt[i];else if (c == 'o') o = cnt[i];else if (c == 'r') r = cnt[i];else if (c == 'w') w = cnt[i];}if (d < 1 || e < 1 || h < 1 || l < 3 || o < 2 || r < 1 || w < 1){Write(0);return;}long ans = 0;for (int leftL = 2; leftL < l; leftL++){int rightL = l - leftL;for (int leftO = 1; leftO < o; leftO++){int rightO = o - leftO;long buf = 1L * h * e * (leftL * (leftL - 1) / 2) * leftO * w * rightO * r * rightL * d;ans = Math.Max(ans, buf);}}Write(ans);}void Write(object val){Console.WriteLine(val.ToString());}void Write(string format, params object[] vals){Console.WriteLine(format, vals);}}class Scanner{Queue<String> buffer;char[] sep;System.IO.TextReader reader;public Scanner(System.IO.TextReader reader = null){this.buffer = new Queue<string>();this.sep = new char[] { ' ' };this.reader = (reader ?? Console.In);}private void CheckBuffer(){if (this.buffer.Count == 0 && this.reader.Peek() >= 0){string[] sreArray = this.reader.ReadLine().Split(this.sep);foreach (String elStr in sreArray){this.buffer.Enqueue(elStr);}}}public String Next{get{this.CheckBuffer();return this.buffer.Dequeue();}}public int NextInt{get{return int.Parse(this.Next);}}public double NextDouble{get{return double.Parse(this.Next);}}public long NextLong{get{return long.Parse(this.Next);}}public bool IsEmpty{get{this.CheckBuffer();return this.buffer.Count == 0;}}}}