結果

問題 No.1624 三角形の反射
コンテスト
ユーザー titia
提出日時 2026-02-10 04:59:01
言語 PyPy3
(7.3.17)
結果
WA  
実行時間 -
コード長 2,018 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,386 ms
コンパイル使用メモリ 82,072 KB
実行使用メモリ 55,000 KB
最終ジャッジ日時 2026-02-10 04:59:08
合計ジャッジ時間 6,273 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline

a=input().strip()

A=""
for x in a:
    if x==".":
        continue
    A+=x

a=int(A)

ANS=0
x=0
y=0

while True:
    #print(x,y,ANS)
    # (x,y)から
    # (x^1,y+a)へ

    tox=x^1
    toy=y+a

    k=toy//1000

    if toy%1000!=0 and k==y//1000:
        ANS+=2

    

    elif 0<=y<1000 and x==0:
        if toy%2000==0:
            k=toy//1000
            ANS+=(k-2)*2+2
        elif 0<toy%2000<1000:
            k=toy//1000
            ANS+=k*2+2
        elif toy%2000==1000:
            k=toy//1000
            ANS+=(k-1)*2+1
        elif 1000<toy%2000<2000:
            k=toy//1000
            ANS+=k*2+1
            
    elif 1000<y<2000 and x==0:
        if toy%2000==0:
            k=toy//1000
            ANS+=(k-2)*2
        elif 0<toy%2000<1000:
            k=toy//1000
            ANS+=k*2-1
        elif toy%2000==1000:
            k=toy//1000
            ANS+=(k-2)*2
        elif 1000<toy%2000<2000:
            k=toy//1000
            ANS+=(k-1)*2

    elif 1000<=y<2000 and x==1:
        if toy%2000==0:
            k=toy//1000
            ANS+=(k-2)*2+1
        elif 0<toy%2000<1000:
            k=toy//1000
            ANS+=k*2-1
        elif toy%2000==1000:
            k=toy//1000
            ANS+=(k-2)*2
        elif 1000<toy%2000<2000:
            k=toy//1000
            ANS+=k*2
            
    elif 0<y<1000 and x==1:
        if toy%2000==0:
            k=toy//1000
            ANS+=(k-1)*2
        elif 0<toy%2000<1000:
            k=toy//1000
            ANS+=k*2+2
        elif toy%2000==1000:
            k=toy//1000
            ANS+=(k-1)*2
        elif 1000<toy%2000<2000:
            k=toy//1000
            ANS+=k*2+1

    x=tox
    y=toy%2000

    if x==0:
        if y==0:
            print("A",ANS)
            break
        elif y==1000:
            print("C",ANS)
            break
    elif x==1:
        if y==0:
            print("B",ANS)
            break
        elif y==1000:
            print("A",ANS)
            break
        
0