結果

問題 No.232 めぐるはめぐる (2)
ユーザー MamonboMamonbo
提出日時 2015-07-05 18:55:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,748 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 11,100 KB
実行使用メモリ 8,792 KB
最終ジャッジ日時 2023-09-22 06:24:38
合計ジャッジ時間 3,265 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 16 ms
8,248 KB
testcase_05 AC 15 ms
8,240 KB
testcase_06 AC 15 ms
8,360 KB
testcase_07 AC 15 ms
8,416 KB
testcase_08 RE -
testcase_09 AC 15 ms
8,212 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 15 ms
8,312 KB
testcase_13 AC 16 ms
8,364 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 16 ms
8,324 KB
testcase_17 AC 15 ms
8,320 KB
testcase_18 RE -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 15 ms
8,296 KB
testcase_22 AC 15 ms
8,220 KB
testcase_23 AC 15 ms
8,216 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