結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー ayaoniayaoni
提出日時 2020-11-26 19:30:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 471 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 77,436 KB
最終ジャッジ日時 2023-10-01 03:28:27
合計ジャッジ時間 6,761 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,452 KB
testcase_01 AC 74 ms
71,332 KB
testcase_02 AC 78 ms
71,456 KB
testcase_03 AC 77 ms
71,516 KB
testcase_04 AC 77 ms
71,292 KB
testcase_05 AC 79 ms
71,440 KB
testcase_06 AC 76 ms
71,436 KB
testcase_07 AC 76 ms
71,120 KB
testcase_08 AC 78 ms
71,432 KB
testcase_09 AC 76 ms
71,432 KB
testcase_10 AC 76 ms
71,496 KB
testcase_11 AC 75 ms
71,500 KB
testcase_12 AC 76 ms
71,236 KB
testcase_13 AC 77 ms
71,432 KB
testcase_14 AC 109 ms
77,308 KB
testcase_15 AC 114 ms
77,224 KB
testcase_16 AC 100 ms
77,068 KB
testcase_17 AC 77 ms
71,408 KB
testcase_18 AC 107 ms
77,376 KB
testcase_19 AC 112 ms
76,856 KB
testcase_20 AC 120 ms
77,068 KB
testcase_21 AC 108 ms
76,892 KB
testcase_22 AC 92 ms
76,480 KB
testcase_23 AC 110 ms
76,972 KB
testcase_24 AC 97 ms
77,252 KB
testcase_25 AC 105 ms
77,180 KB
testcase_26 AC 116 ms
77,244 KB
testcase_27 AC 110 ms
77,076 KB
testcase_28 AC 111 ms
77,044 KB
testcase_29 AC 117 ms
77,096 KB
testcase_30 AC 87 ms
76,584 KB
testcase_31 AC 79 ms
71,216 KB
testcase_32 AC 99 ms
76,892 KB
testcase_33 AC 106 ms
77,436 KB
testcase_34 AC 100 ms
77,044 KB
testcase_35 AC 110 ms
77,340 KB
testcase_36 AC 85 ms
76,792 KB
testcase_37 AC 111 ms
77,076 KB
testcase_38 AC 105 ms
77,200 KB
testcase_39 AC 93 ms
76,812 KB
testcase_40 AC 119 ms
77,248 KB
testcase_41 AC 98 ms
77,284 KB
testcase_42 AC 115 ms
77,124 KB
testcase_43 AC 106 ms
77,240 KB
testcase_44 AC 113 ms
77,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from math import gcd
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())


P,Q = MI()
g = gcd(P,Q)

N = I()
ans = 0
for _ in range(N):
    X,Y = MI()
    if g == 0:
        if X == Y == 0:
            ans += 1
        continue
    if X % g == Y % g == 0:
        if (P//g+Q//g) % 2 == 0:
            if (X//g+Y//g) % 2 == 0:
                ans += 1
        else:
            ans += 1

print(ans)
0