結果
| 問題 |
No.197 手品
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-28 23:57:17 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 12 ms / 1,000 ms |
| コード長 | 820 bytes |
| コンパイル時間 | 71 ms |
| コンパイル使用メモリ | 6,912 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2024-07-20 03:34:37 |
| 合計ジャッジ時間 | 1,618 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 43 |
ソースコード
#!/usr/bin/python
# -*- coding: utf-8 -*-
# †
# (ΦωΦ)<頼むぜ!
def f(s0, s1, c):
if s0[0] == c and s1[2] == c:
return 1
if s0[2] == c and s1[0] == c:
return 1
if s0[1] == c and s1[1] == c:
return 1
return 0
def fushigi(s0, s1, n):
s0o = s0.count('o')
s1o = s1.count('o')
if s0o != s1o:
return 1 # コインの数が違ってたらふしぎ!
if n == 0:
return s0 != s1 # なんもしてないのに違ってたらふしぎ!
if n == 1:
if s0o == 1:
if f(s0, s1, 'o'):
return 1
elif s0o == 2:
if f(s0, s1, 'x'):
return 1
return 0
s0 = raw_input()
n = int(raw_input())
s1 = raw_input()
if fushigi(s0, s1, n):
print 'SUCCESS'
else:
print 'FAILURE'