結果
| 問題 |
No.455 冬の大三角
|
| コンテスト | |
| ユーザー |
くれちー
|
| 提出日時 | 2016-12-05 22:42:13 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 2,000 ms |
| コード長 | 1,111 bytes |
| コンパイル時間 | 2,631 ms |
| コンパイル使用メモリ | 104,192 KB |
| 実行使用メモリ | 19,328 KB |
| 最終ジャッジ日時 | 2024-06-29 20:58:19 |
| 合計ジャッジ時間 | 6,208 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.Collections.Generic;
using P = System.Numerics.Complex;
class Program
{
static void Main()
{
string[] str = Console.ReadLine().Split(' ');
int h = int.Parse(str[0]);
int w = int.Parse(str[1]);
var s = new List<char[]>(3);
var star = new List<P>(3);
for (int i = 0; i < h; i++)
{
s.Add(Console.ReadLine().ToCharArray());
for (int j = 0; j < w; j++)
if (s[i][j] == '*') star.Add(new P(i, j));
}
var rand = new Random();
int sh, sw;
while (true)
{
sh = rand.Next(h);
sw = rand.Next(w);
if (star.Count < 3) star.Add(new P(sh, sw));
else star[2] = new P(sh, sw);
P vec1 = star[1] - star[0];
P vec2 = star[2] - star[0];
if (vec1.Real * vec2.Imaginary - vec1.Imaginary * vec2.Real != 0)
{
s[sh][sw] = '*';
for (int i = 0; i < h; i++) Console.WriteLine(s[i]);
return;
}
}
}
}
くれちー