結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー ckawatakckawatak
提出日時 2019-04-13 17:37:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 159 ms / 2,000 ms
コード長 488 bytes
コンパイル時間 930 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 77,776 KB
最終ジャッジ日時 2023-10-13 14:26:33
合計ジャッジ時間 8,695 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,576 KB
testcase_01 AC 72 ms
71,288 KB
testcase_02 AC 72 ms
71,276 KB
testcase_03 AC 73 ms
71,496 KB
testcase_04 AC 74 ms
71,280 KB
testcase_05 AC 74 ms
71,136 KB
testcase_06 AC 73 ms
71,088 KB
testcase_07 AC 74 ms
71,320 KB
testcase_08 AC 76 ms
71,296 KB
testcase_09 AC 75 ms
71,348 KB
testcase_10 AC 73 ms
71,220 KB
testcase_11 AC 74 ms
71,272 KB
testcase_12 AC 74 ms
71,552 KB
testcase_13 AC 75 ms
71,244 KB
testcase_14 AC 143 ms
77,612 KB
testcase_15 AC 156 ms
77,460 KB
testcase_16 AC 123 ms
77,640 KB
testcase_17 AC 76 ms
71,152 KB
testcase_18 AC 132 ms
77,452 KB
testcase_19 AC 144 ms
77,776 KB
testcase_20 AC 159 ms
77,356 KB
testcase_21 AC 135 ms
77,272 KB
testcase_22 AC 112 ms
77,592 KB
testcase_23 AC 146 ms
77,580 KB
testcase_24 AC 116 ms
77,512 KB
testcase_25 AC 136 ms
77,504 KB
testcase_26 AC 157 ms
77,536 KB
testcase_27 AC 143 ms
77,600 KB
testcase_28 AC 145 ms
77,396 KB
testcase_29 AC 157 ms
77,496 KB
testcase_30 AC 103 ms
76,928 KB
testcase_31 AC 85 ms
75,812 KB
testcase_32 AC 129 ms
77,584 KB
testcase_33 AC 133 ms
77,560 KB
testcase_34 AC 125 ms
77,532 KB
testcase_35 AC 147 ms
77,432 KB
testcase_36 AC 103 ms
77,152 KB
testcase_37 AC 148 ms
77,376 KB
testcase_38 AC 132 ms
77,388 KB
testcase_39 AC 111 ms
77,372 KB
testcase_40 AC 156 ms
77,444 KB
testcase_41 AC 120 ms
77,544 KB
testcase_42 AC 149 ms
77,272 KB
testcase_43 AC 129 ms
77,480 KB
testcase_44 AC 147 ms
77,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

P,Q = list(map(int, input().split()))
N = int(input())

g = math.gcd(P,Q)

if g != 0:
    P = P // g
    Q = Q // g

count = 0    
for _ in range(N):
    x,y = list(map(int, input().split()))
    
    if g == 0:
        if x == 0 and y == 0:
            count = count + 1
        continue
        
    if x % g != 0 or y % g != 0:
        continue

    x = x // g
    y = y // g
    if (P+Q) % 2 == 0 and (x+y) % 2 != 0:
        continue

    count = count + 1

print(count)
0