結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー 👑 SPD_9X2
提出日時 2025-08-05 23:40:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 469 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 82,812 KB
実行使用メモリ 77,188 KB
最終ジャッジ日時 2025-08-05 23:40:27
合計ジャッジ時間 7,090 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

https://yukicoder.me/problems/no/321

場合分けかなぁ

1,3


"""

import math

P,Q = map(int,input().split())
P = abs(P)
Q = abs(Q)

G = math.gcd(abs(P-Q),abs(P+Q))

N = int(input())

ans = 0

for i in range(N):

    X,Y = map(int,input().split())

    flag = False

    if P == 0 and Q == 0:
        if X == Y == 0:
            flag = True
    else:
        if X % G == 0 and Y % G == 0:
            flag = True

    if flag:
        ans += 1

print (ans)
0