結果
| 問題 | No.1624 三角形の反射 | 
| コンテスト | |
| ユーザー |  sasa8uyauya | 
| 提出日時 | 2024-09-20 19:06:55 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 57 ms / 2,000 ms | 
| コード長 | 484 bytes | 
| コンパイル時間 | 283 ms | 
| コンパイル使用メモリ | 82,428 KB | 
| 実行使用メモリ | 61,312 KB | 
| 最終ジャッジ日時 | 2024-09-20 19:06:58 | 
| 合計ジャッジ時間 | 2,334 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 22 | 
ソースコード
a,b=input().split(".")
x=1000
y=int(a+b)
from math import gcd
g=gcd(x,y)
x//=g
y//=g
c=x-1+y-1
if x==y:
  print("A",1)
  exit()
for i in range(x+y+1):
  if y>x:
    c+=0<(2*i+1)*x<x*(y-x)
    c+=0<(-(2*i+1))*x<x*(y-x)
    c+=0<(2*i+1)*x<x*(y+x)
  else:
    c+=0>(2*i+1)*x>x*(y-x)
    c+=0>(-(2*i+1))*x>x*(y-x)
    c+=0<(2*i+1)*x<x*(y+x)
if y%2==0 and x%2==0:
  print("A",c)
if y%2==0 and x%2==1:
  print("B",c)
if y%2==1 and x%2==0:
  print("C",c)
if y%2==1 and x%2==1:
  print("A",c)
            
            
            
        