結果

問題 No.455 冬の大三角
ユーザー 14番14番
提出日時 2016-12-14 21:35:16
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 2,121 bytes
コンパイル時間 4,405 ms
コンパイル使用メモリ 104,200 KB
実行使用メモリ 24,012 KB
最終ジャッジ日時 2023-09-12 08:55:20
合計ジャッジ時間 10,731 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
21,824 KB
testcase_01 AC 62 ms
23,880 KB
testcase_02 AC 61 ms
21,896 KB
testcase_03 AC 62 ms
24,012 KB
testcase_04 AC 62 ms
21,944 KB
testcase_05 AC 61 ms
21,988 KB
testcase_06 AC 62 ms
23,976 KB
testcase_07 AC 61 ms
19,884 KB
testcase_08 AC 64 ms
21,936 KB
testcase_09 AC 61 ms
23,968 KB
testcase_10 AC 61 ms
24,000 KB
testcase_11 AC 61 ms
21,936 KB
testcase_12 AC 60 ms
19,812 KB
testcase_13 AC 60 ms
21,992 KB
testcase_14 AC 60 ms
21,824 KB
testcase_15 AC 61 ms
21,960 KB
testcase_16 AC 63 ms
21,864 KB
testcase_17 AC 62 ms
21,864 KB
testcase_18 AC 61 ms
21,988 KB
testcase_19 AC 61 ms
21,772 KB
testcase_20 AC 63 ms
23,904 KB
testcase_21 AC 64 ms
23,904 KB
testcase_22 AC 61 ms
21,848 KB
testcase_23 AC 61 ms
23,880 KB
testcase_24 AC 62 ms
23,900 KB
testcase_25 AC 61 ms
21,892 KB
testcase_26 AC 62 ms
21,912 KB
testcase_27 AC 62 ms
23,984 KB
testcase_28 AC 62 ms
21,948 KB
testcase_29 AC 63 ms
21,788 KB
testcase_30 AC 63 ms
21,860 KB
testcase_31 AC 62 ms
21,964 KB
testcase_32 AC 63 ms
21,888 KB
testcase_33 AC 63 ms
19,896 KB
testcase_34 AC 61 ms
21,844 KB
testcase_35 AC 63 ms
23,824 KB
testcase_36 AC 63 ms
23,908 KB
testcase_37 AC 62 ms
21,772 KB
testcase_38 AC 62 ms
21,864 KB
testcase_39 AC 63 ms
21,944 KB
testcase_40 AC 64 ms
23,996 KB
testcase_41 AC 62 ms
21,840 KB
testcase_42 AC 62 ms
23,992 KB
testcase_43 AC 62 ms
21,948 KB
testcase_44 AC 62 ms
21,844 KB
testcase_45 AC 64 ms
23,880 KB
testcase_46 AC 63 ms
21,948 KB
testcase_47 AC 62 ms
21,968 KB
testcase_48 AC 63 ms
21,920 KB
testcase_49 AC 60 ms
21,956 KB
testcase_50 AC 62 ms
24,012 KB
testcase_51 AC 61 ms
21,844 KB
testcase_52 AC 62 ms
23,880 KB
testcase_53 AC 62 ms
21,864 KB
testcase_54 AC 62 ms
23,936 KB
testcase_55 AC 61 ms
21,960 KB
testcase_56 AC 62 ms
22,052 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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();
    }
}
0