結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー rlangevinrlangevin
提出日時 2023-10-26 12:29:32
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 386 bytes
コンパイル時間 347 ms
コンパイル使用メモリ 81,812 KB
実行使用メモリ 75,780 KB
最終ジャッジ日時 2023-10-26 12:29:37
合計ジャッジ時間 5,094 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 35 ms
53,716 KB
testcase_02 AC 34 ms
53,716 KB
testcase_03 AC 34 ms
53,716 KB
testcase_04 AC 34 ms
53,716 KB
testcase_05 RE -
testcase_06 AC 34 ms
53,716 KB
testcase_07 AC 33 ms
53,716 KB
testcase_08 AC 34 ms
53,716 KB
testcase_09 AC 37 ms
53,716 KB
testcase_10 AC 43 ms
53,716 KB
testcase_11 AC 34 ms
53,716 KB
testcase_12 AC 34 ms
53,716 KB
testcase_13 AC 33 ms
53,716 KB
testcase_14 AC 65 ms
75,704 KB
testcase_15 AC 71 ms
75,596 KB
testcase_16 AC 56 ms
75,604 KB
testcase_17 AC 34 ms
53,720 KB
testcase_18 AC 60 ms
75,668 KB
testcase_19 AC 91 ms
75,780 KB
testcase_20 AC 73 ms
75,668 KB
testcase_21 AC 63 ms
75,596 KB
testcase_22 AC 48 ms
68,528 KB
testcase_23 AC 67 ms
75,596 KB
testcase_24 AC 50 ms
72,620 KB
testcase_25 AC 60 ms
75,596 KB
testcase_26 AC 71 ms
75,604 KB
testcase_27 AC 67 ms
75,708 KB
testcase_28 AC 66 ms
75,612 KB
testcase_29 AC 70 ms
75,592 KB
testcase_30 AC 42 ms
62,364 KB
testcase_31 AC 38 ms
53,720 KB
testcase_32 AC 61 ms
75,592 KB
testcase_33 AC 62 ms
75,700 KB
testcase_34 AC 61 ms
75,608 KB
testcase_35 AC 69 ms
75,604 KB
testcase_36 AC 42 ms
62,368 KB
testcase_37 AC 64 ms
75,608 KB
testcase_38 AC 61 ms
75,604 KB
testcase_39 AC 48 ms
68,520 KB
testcase_40 AC 73 ms
75,604 KB
testcase_41 AC 52 ms
72,620 KB
testcase_42 AC 69 ms
75,672 KB
testcase_43 AC 59 ms
75,608 KB
testcase_44 AC 68 ms
75,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from math import gcd

P, Q = map(int, input().split())
g = gcd(P, Q)
P //= g
Q //= g
ans = 0
N = int(input())
for _ in range(N):
    X, Y = map(int, input().split())
    if X % g or Y % g:
        continue
    X //= g
    Y //= g
    if P % 2 == 0 or Q % 2 == 0:
        ans += 1
        continue
    if X % 2 == Y % 2:
        ans += 1

print(ans)
0