結果

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

ソースコード

diff #

import math
P,Q=map(int,input().split())
if P+Q==0:
    print(0)
    exit()
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