結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー 👑 rin204
提出日時 2023-02-08 20:40:37
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 359 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 82,276 KB
実行使用メモリ 76,884 KB
最終ジャッジ日時 2024-07-06 06:22:27
合計ジャッジ時間 5,727 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 39 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

p, q = map(int, input().split())
g = gcd(p, q)
p //= g
q //= g
if (p + q) % 2 == 0:
    bi = True
else:
    bi = False
n = int(input())
ans = 0
for _ in range(n):
    x, y = map(int, input().split())
    if x % g != 0 or y % g != 0:
        continue
    x //= g
    y //= g
    if not bi or (x + y) % 2 == 0:
        ans += 1
print(ans)
0