結果

問題 No.486 3 Straight Win(3連勝)
ユーザー toshiro_yanagi
提出日時 2018-06-03 16:54:32
言語 Nim
(2.2.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 333 bytes
コンパイル時間 2,509 ms
コンパイル使用メモリ 61,712 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 09:24:59
合計ジャッジ時間 4,091 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
const goal = 3
let S = stdin.readLine
var cnt, m: array[2, int]

for s in S:
  m[0] = int(s == 'X')
  m[1] = int(s == 'O')

  for i in 0 ..< 2:
    if cnt[i] == 0:
      cnt[i] += m[i]
    else:
      cnt[i] *= 2 * m[i]

  if cnt.max >= 2 ^ (goal - 1):
    echo ["West", "East"][find(cnt, cnt.max)]
    quit()

echo "NA"
0