結果

問題 No.455 冬の大三角
ユーザー mban
提出日時 2016-12-30 21:45:23
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 1,419 bytes
コンパイル時間 2,101 ms
コンパイル使用メモリ 107,392 KB
実行使用メモリ 19,200 KB
最終ジャッジ日時 2024-06-29 22:10:59
合計ジャッジ時間 5,580 ms
ジャッジサーバーID
(参考情報)
judge2 / 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.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

class Magatro
{
    static int H, W;
    static void Main()
    {
        string[] s = Console.ReadLine().Split(' ');
        H = int.Parse(s[0]);
        W = int.Parse(s[1]);
        char[][] Sky = new char[H][];
        P[] a = new P[2];
        int c = 0;
        for (int i = 0; i < H; i++)
        {
            Sky[i] = Console.ReadLine().ToArray();
        }
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                if (Sky[i][j] == '*')
                {
                    a[c] = new P(i, j);
                    c++;
                }
            }
        }
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++) {
                int T = a[0].Y * (a[1].X - j) + a[1].Y * (j - a[0].X) + i * (a[0].X - a[1].X);
                if (T != 0)
                {
                    Sky[i][j] = '*';
                    for (int k = 0; k < H; k++)
                    {
                        Console.WriteLine(new String(Sky[k]));
                    }
                    return;
                }
            }
        }
    }
}
struct P
{
    public P(int y,int x)
    {
        Y = y;
        X = x;
    }
    public int X, Y;
}
0