結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー ayaoni
提出日時 2020-11-26 19:27:59
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 394 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 82,168 KB
実行使用メモリ 76,552 KB
最終ジャッジ日時 2024-07-23 20:55:47
合計ジャッジ時間 5,869 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 39 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from math import gcd
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())


P,Q = MI()
g = gcd(P,Q)

N = I()
ans = 0
for _ in range(N):
    X,Y = MI()
    if X % g == Y % g == 0:
        if (P//g+Q//g) % 2 == 0:
            if (X//g+Y//g) % 2 == 0:
                ans += 1
        else:
            ans += 1

print(ans)
0