結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー fumofumofuni
提出日時 2021-09-14 01:21:23
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 342 bytes
コンパイル時間 936 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2024-06-26 03:30:02
合計ジャッジ時間 7,741 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 39 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
P,Q=map(int,input().split())
N=int(input())
res=0
g=math.gcd(P,Q)
P//=g
Q//=g
for i in range(N):
    X,Y=map(int,input().split())
    X=abs(X)
    Y=abs(Y)
    if X%g==0 and Y%g==0:
        X//=g
        Y//=g
        if P%2 and Q%2:
            if (X+Y)%2==0:
                res+=1
        else:
            res+=1
print(res)


0