結果
| 問題 | No.197 手品 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-06-03 12:50:29 |
| 言語 | PyPy2 (7.3.20) |
| 結果 |
AC
|
| 実行時間 | 82 ms / 1,000 ms |
| コード長 | 850 bytes |
| 記録 | |
| コンパイル時間 | 301 ms |
| コンパイル使用メモリ | 77,556 KB |
| 最終ジャッジ日時 | 2025-12-03 15:29:46 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 43 |
ソースコード
# -*- coding:utf-8 -*-
if __name__ == "__main__":
s_before = raw_input()
n = input()
s_after = raw_input()
a,b = 0,0
for i,j in zip(s_before,s_after):
if i == "o":
b += 1
if j == "o":
a += 1
if a != b:
print "SUCCESS"
elif (a == 3 and b == 3) or (a == 0 and b == 0):
print "FAILURE"
else:
if n >= 2:
print "FAILURE"
elif n == 1:
if a == 1:
d = abs(s_before.index("o") - s_after.index("o"))
if d == 1:
print "FAILURE"
elif d == 0 and s_before.index("o") != 1:
print "FAILURE"
else:
print "SUCCESS"
else:
d = abs(s_before.index("x") - s_after.index("x"))
if d == 1:
print "FAILURE"
elif d == 0 and s_before.index("x") != 1:
print "FAILURE"
else:
print "SUCCESS"
elif n == 0:
if s_after == s_before:
print "FAILURE"
else:
print "SUCCESS"