結果

問題 No.197 手品
ユーザー ktshun
提出日時 2015-06-03 12:50:29
言語 Python2
(2.7.18)
結果
AC  
実行時間 11 ms / 1,000 ms
コード長 850 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-07-20 03:40:53
合計ジャッジ時間 1,869 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- 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"
0