結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー 👑 rin204rin204
提出日時 2023-02-08 20:41:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 592 bytes
コンパイル時間 342 ms
コンパイル使用メモリ 87,288 KB
実行使用メモリ 77,712 KB
最終ジャッジ日時 2023-09-20 10:55:25
合計ジャッジ時間 7,379 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,436 KB
testcase_01 AC 72 ms
71,448 KB
testcase_02 WA -
testcase_03 AC 74 ms
71,444 KB
testcase_04 AC 73 ms
71,196 KB
testcase_05 AC 72 ms
71,136 KB
testcase_06 WA -
testcase_07 AC 74 ms
71,288 KB
testcase_08 AC 72 ms
71,388 KB
testcase_09 AC 72 ms
71,392 KB
testcase_10 AC 73 ms
71,204 KB
testcase_11 AC 74 ms
71,448 KB
testcase_12 AC 72 ms
71,352 KB
testcase_13 AC 71 ms
71,444 KB
testcase_14 AC 129 ms
77,500 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 74 ms
71,304 KB
testcase_18 AC 120 ms
77,332 KB
testcase_19 AC 129 ms
77,676 KB
testcase_20 AC 144 ms
77,648 KB
testcase_21 AC 125 ms
77,616 KB
testcase_22 WA -
testcase_23 AC 135 ms
77,572 KB
testcase_24 AC 111 ms
77,524 KB
testcase_25 AC 123 ms
77,540 KB
testcase_26 AC 141 ms
77,416 KB
testcase_27 AC 133 ms
77,600 KB
testcase_28 AC 133 ms
77,632 KB
testcase_29 AC 141 ms
77,480 KB
testcase_30 AC 96 ms
76,852 KB
testcase_31 AC 81 ms
71,388 KB
testcase_32 AC 119 ms
77,572 KB
testcase_33 AC 123 ms
77,532 KB
testcase_34 AC 116 ms
77,712 KB
testcase_35 AC 134 ms
77,516 KB
testcase_36 AC 97 ms
77,144 KB
testcase_37 AC 127 ms
77,520 KB
testcase_38 AC 119 ms
77,292 KB
testcase_39 AC 104 ms
77,272 KB
testcase_40 AC 142 ms
77,280 KB
testcase_41 AC 112 ms
77,592 KB
testcase_42 AC 137 ms
77,624 KB
testcase_43 AC 117 ms
77,496 KB
testcase_44 AC 131 ms
77,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

p, q = map(int, input().split())

if p == 0 or q == 0:
    ans = 0
    n = int(input())
    if p == 0 and q == 0:
        for _ in range(n):
            x, y = map(int, input().split())
            if x == y == 0:
                ans += 1
    print(ans)
    exit()

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