結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー 👑 rin204rin204
提出日時 2023-02-08 20:40:37
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 359 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 79,364 KB
最終ジャッジ日時 2023-09-20 10:54:49
合計ジャッジ時間 8,187 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 70 ms
71,372 KB
testcase_02 AC 72 ms
71,340 KB
testcase_03 AC 72 ms
71,768 KB
testcase_04 AC 72 ms
71,536 KB
testcase_05 RE -
testcase_06 AC 72 ms
71,776 KB
testcase_07 AC 73 ms
71,368 KB
testcase_08 AC 72 ms
71,444 KB
testcase_09 AC 72 ms
71,368 KB
testcase_10 AC 73 ms
71,540 KB
testcase_11 AC 73 ms
71,368 KB
testcase_12 AC 73 ms
71,740 KB
testcase_13 AC 73 ms
71,544 KB
testcase_14 AC 128 ms
77,628 KB
testcase_15 AC 142 ms
77,544 KB
testcase_16 AC 117 ms
77,596 KB
testcase_17 AC 75 ms
71,396 KB
testcase_18 AC 122 ms
77,592 KB
testcase_19 AC 130 ms
77,348 KB
testcase_20 AC 144 ms
77,400 KB
testcase_21 AC 124 ms
77,376 KB
testcase_22 AC 108 ms
77,404 KB
testcase_23 AC 136 ms
77,516 KB
testcase_24 AC 111 ms
77,604 KB
testcase_25 AC 124 ms
77,580 KB
testcase_26 AC 142 ms
77,648 KB
testcase_27 AC 134 ms
77,508 KB
testcase_28 AC 131 ms
77,316 KB
testcase_29 AC 142 ms
77,372 KB
testcase_30 AC 97 ms
77,000 KB
testcase_31 AC 81 ms
71,772 KB
testcase_32 AC 117 ms
77,580 KB
testcase_33 AC 123 ms
77,728 KB
testcase_34 AC 116 ms
77,416 KB
testcase_35 AC 132 ms
77,596 KB
testcase_36 AC 94 ms
77,076 KB
testcase_37 AC 126 ms
77,464 KB
testcase_38 AC 124 ms
77,540 KB
testcase_39 AC 105 ms
77,400 KB
testcase_40 AC 141 ms
77,532 KB
testcase_41 AC 111 ms
77,384 KB
testcase_42 AC 134 ms
77,428 KB
testcase_43 AC 116 ms
77,580 KB
testcase_44 AC 131 ms
77,328 KB
権限があれば一括ダウンロードができます

ソースコード

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