結果

問題 No.455 冬の大三角
ユーザー t8m8⛄️
提出日時 2016-12-06 01:25:07
言語 Nim
(2.2.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 663 bytes
コンパイル時間 2,739 ms
コンパイル使用メモリ 65,508 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-29 21:05:41
合計ジャッジ時間 4,374 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils

when isMainModule:
  var
    tmp = stdin.readLine.split.map(parseInt)
    (h, w) = (tmp[0], tmp[1])

  var s = newSeq[string](h)
  for i in 0..h-1:
    s[i] = stdin.readLine

  var p = newSeq[(int, int)]()
  for i in 0..h-1:
    for j in 0..w-1:
      if s[i][j] == '*':
        p.add((i, j))

  var x, y: int
  if p[0][0] == p[1][0]:
    if p[0][0] == h-1: y = p[0][0] - 1
    else: y = p[0][0] + 1
    x = p[0][1]
  else:
    if p[0][1] == w-1: x = p[0][1] - 1
    else: x = p[0][1] + 1
    y = p[0][0]

  for i in 0..h-1:
    for j in 0..w-1:
      if y == i and x == j: stdout.write('*')
      else: stdout.write(s[i][j])
    echo()
0