結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー ああいいああいい
提出日時 2022-03-02 12:07:20
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 553 bytes
コンパイル時間 968 ms
コンパイル使用メモリ 86,768 KB
実行使用メモリ 80,244 KB
最終ジャッジ日時 2023-09-23 05:53:13
合計ジャッジ時間 11,136 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,344 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 WA -
testcase_05 AC 75 ms
71,028 KB
testcase_06 RE -
testcase_07 AC 74 ms
71,288 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 74 ms
71,200 KB
testcase_11 WA -
testcase_12 AC 73 ms
71,028 KB
testcase_13 AC 73 ms
71,296 KB
testcase_14 WA -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 WA -
testcase_20 RE -
testcase_21 WA -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 WA -
testcase_26 RE -
testcase_27 WA -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 WA -
testcase_34 RE -
testcase_35 WA -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 WA -
testcase_40 RE -
testcase_41 WA -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def gcd(a,b):
    if b == 0:return a
    while True:
        r =a % b
        a = b
        b = r
        if r == 0:return a
ans = 0
d = gcd(p,q)
if d != 0:
    p //= d
    q //= d
    if (p+q) % 2 == 0:
        flag = True
for _ in range(N):
    x,y = map(int,input().split())
    if d == 0:
        if x == 0 and y == 0:ans += 1
        continue
    if x % d == 0 and y % d == 0:
        x //= d
        y //= d
        if flag:
            if (x+y)% 2 == 0:ans+= 1
            else:ans += 1
print(ans)
0