結果

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

ソースコード

diff #

#208.py
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 = -1,-1
c = 0

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