結果
問題 |
No.205 マージして辞書順最小
|
ユーザー |
![]() |
提出日時 | 2017-06-26 19:33:59 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,170 bytes |
コンパイル時間 | 1,027 ms |
コンパイル使用メモリ | 109,888 KB |
実行使用メモリ | 30,548 KB |
最終ジャッジ日時 | 2024-10-04 09:43:51 |
合計ジャッジ時間 | 3,402 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 10 RE * 5 |
コンパイルメッセージ
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; using System.Collections.Generic; using System.Collections.Specialized; using System.Text; using System.Text.RegularExpressions; using System.Linq; using System.IO; class Program { static void Main() { new Magatro().Solve(); } } class Magatro { private int N; private string[] S; private int Length = 0; private void Scan() { N = int.Parse(Console.ReadLine()); S = new string[N]; for (int i = 0; i < N; i++) { string line = Console.ReadLine(); Length += line.Length; S[i] = line + (char)255; } } public void Solve() { Scan(); string ans = ""; for (int i = 0; i < Length; i++) { int index = 0; string min = S[0]; for (int j = 1; j < N; j++) { if (min.CompareTo(S[j]) > 0) { min = S[j]; index = j; } } ans += min[0]; S[index] = min.Substring(1); } Console.WriteLine(ans); } }