結果

問題 No.208 王将
ユーザー TeraokaAkihiro
提出日時 2016-10-29 22:07:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 21,504 KB
最終ジャッジ日時 2024-11-24 23:26:29
合計ジャッジ時間 5,729 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 16 WA * 5 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

tx,ty = input().split()
hx,hy = input().split()

tx,ty = int(tx),int(ty)
hx,hy = int(hx),int(hy)
x,y = 0,0
#x_,y_ = 0,0
lx,ly = 0,0
c = 0
pt = 0

while (tx != x)&(ty != y):
    c += 1
    lx = tx-x
    ly = ty-y
    if (lx==ly):
        pt = 1
        x,y = x+1,y+1
    if (lx> ly):
        pt = 2
        x += 1
    if (lx< ly):
        pt = 3
        y += 1
    if (x == hx)&(y == hy):
        if (pt == 1):
            x-=1
        if (pt == 2):
            y+=1
        if (pt == 3):
            x+=1
    #x_,y_ = x,y
print(c)
0