結果
問題 | No.455 冬の大三角 |
ユーザー |
![]() |
提出日時 | 2016-12-14 21:35:16 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 2,121 bytes |
コンパイル時間 | 3,140 ms |
コンパイル使用メモリ | 112,328 KB |
実行使用メモリ | 21,120 KB |
最終ジャッジ日時 | 2024-06-29 21:39:27 |
合計ジャッジ時間 | 6,280 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Linq;using System.Collections.Generic;using System.Text;public class Program{public void Proc() {Reader.IsDebug = false;int[] inpt = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray();int row = inpt[0];int col = inpt[1];List<Pos> stars = new List<Pos>();for(int i=0; i<row; i++) {string str = Reader.ReadLine();for(int j=0; j<str.Length; j++) {if(str[j] == '*') {stars.Add(new Pos(j,i));}}if(stars.Count >= 2) {break;}}Pos last = new Pos(stars[0].X, stars[0].Y);if(stars[0].X == stars[1].X) {last.X = last.X-1>=0?last.X-1:last.X+1;} else {last.Y = last.Y-1>=0?last.Y-1:last.Y+1;}stars.Add(last);StringBuilder ans = new StringBuilder();for(int i=0; i<row; i++) {for(int j=0; j<col; j++) {if(stars.Any(a=>a.X == j && a.Y == i)) {ans.Append("*");} else {ans.Append("-");}}ans.AppendLine(string.Empty);}Console.Write(ans.ToString());}public struct Pos {public int X;public int Y;public Pos(int x, int y) {this.X = x;this.Y = y;}}public class Reader {public static bool IsDebug = true;private static System.IO.StringReader SReader;private static string InitText = @"";public static string ReadLine() {if(IsDebug) {if(SReader == null) {SReader = new System.IO.StringReader(InitText.Trim());}return SReader.ReadLine();} else {return Console.ReadLine();}}}public static void Main(string[] args){Program prg = new Program();prg.Proc();}}