結果

問題 No.438 Cwwプログラミング入門
ユーザー nebukuro09nebukuro09
提出日時 2016-10-28 23:40:26
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 512 bytes
コンパイル時間 520 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 167,896 KB
最終ジャッジ日時 2024-11-24 20:29:31
合計ジャッジ時間 52,109 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 46 WA * 44 TLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

x, y, z = map(int, raw_input().split())
visited = set()
d = [(x, 'cC'), (y, 'wC'), (-x, 'cW'), (-y, 'wW')]

stack = [(x, 'c'), (y, 'w')]
while len(stack) > 0:
    num, code = stack.pop()
    #print num
    if num in visited or num < 0:
        continue
    if num == z:
        print code
        exit()
    visited.add(num)
    if len(code) >= 9999:
        continue
    for nn, nc in d:
        if num+nn not in visited and num+nn >= 0:
            stack.append((num+nn, code+nc))

print 'mourennaihasimasenn'
0