結果

問題 No.197 手品
ユーザー aka_satana_haaka_satana_ha
提出日時 2017-11-27 14:25:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 977 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-06-27 13:51:30
合計ジャッジ時間 2,649 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 41 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

S_before=input()
N=int(input())
S_after=input()

coin_before=S_before.count('o')
coin_after=S_after.count('o')

#コインの数が違う
if coin_after!=coin_before:
    print("SUCCESS")
    exit()

#コインが0または3つ
if coin_before==0 or coin_before==3:
    print("FAILURE")
    exit()

#コインが1つまたは2つ
if N<1:
    if S_before!=S_after:
        print("SUCCESS")
    else:
        print("FAILURE")
    exit()
elif N==1:
    if (coin_before==1 and S_before[0]=='o' and S_after[2]=='o') or \
       (coin_before==1 and S_before[2]=='o' and S_after[0]=='o') or \
       (coin_before==2 and S_before[0]=='x' and S_after[2]=='x') or \
       (coin_before==2 and S_before[2]=='x' and S_after[0]=='x') or \
       (coin_before==1 and S_before[1]==S_after[1] and S_before=='o') or \
       (coin_before==2 and S_before[1]==S_after[1] and S_before=='x'):
       print("SUCCESS")
    else:
       print("FAILURE")
    exit()
else:
    print("FAILURE")
    exit()
0