結果

問題 No.232 めぐるはめぐる (2)
ユーザー MamonboMamonbo
提出日時 2015-07-05 19:06:46
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,748 bytes
コンパイル時間 1,226 ms
コンパイル使用メモリ 86,748 KB
実行使用メモリ 83,100 KB
最終ジャッジ日時 2023-09-22 06:24:54
合計ジャッジ時間 5,498 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 69 ms
71,236 KB
testcase_05 AC 70 ms
71,036 KB
testcase_06 AC 69 ms
71,384 KB
testcase_07 AC 72 ms
71,040 KB
testcase_08 RE -
testcase_09 AC 72 ms
71,148 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 71 ms
71,236 KB
testcase_13 AC 75 ms
71,300 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 70 ms
71,436 KB
testcase_17 AC 72 ms
71,332 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 71 ms
71,148 KB
testcase_22 AC 69 ms
71,188 KB
testcase_23 AC 69 ms
71,348 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding=UTF-8
#Dragon Slayer I の8歩歩きの話の類い
#余ったときの調整はできそう

#A=Bのとき 最短経路は/
#A>Bのとき 最短経路は_/
#A<Bのとき 最短経路は /
#                  |
#max(A,B)-1歩で(A-1,B-1)に到達できる
#歩き方示せと言ったらそんな感じかな

#再帰ぶん回してみる
def printho(fT,fA,fB):
    if fT==1:
        demoji=""
        if fA==1:
            demoji=demoji+">"
        elif fA==-1:
            demoji=demoji+"<"

        if fB==1:
            demoji=demoji+"^"
        elif fB==-1:
            demoji=demoji+"v"

        print(demoji)
        return    
    else:
        if fA==0 and fB==0:
            print(">")
            fA=fA-1
        elif (fA==-1 or fA==1) and (fB==1 or fB==0):
            print("^")
            fB=fB-1
        elif fA==0 and (fB==-1 or fB==1):
            print(">")
            fA=fA-1
        elif (fA==-1 or fA==1) and fB==-1:
            print("v")
            fB=fB+1
            # ↓→↓
            # ↑ ↑
            # ↑→↑
        else:
            demoji=""
            if fA>=2:
                demoji=demoji+">"
                fA=fA-1
            elif fA<=-2:
                demoji=demoji+"<"
                fA=fA+1
            if fB>=2:
                demoji=demoji+"^"
                fB=fB-1
            elif fB<=-2:
                demoji=demoji+"v"
                fB=fB+1
            print(demoji)
    return printho(fT-1,fA,fB)

hoko=[(-1,-1),(0,-1),(1,-1),(-1,0),(1,0),(-1,1),(0,1),(1,1)]

mojir=input()
hyo=mojir.split(" ")
T=int(hyo[0])
A=int(hyo[1])
B=int(hyo[2])


if T < max(A,B):
    print("NO")
elif A==0 and B==0 and T==1:
    print("NO")
else:
    print("YES")
    printho(T,A,B)
0