結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー fumofumofunifumofumofuni
提出日時 2021-09-14 01:23:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 1,486 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 77,976 KB
最終ジャッジ日時 2023-09-08 10:11:02
合計ジャッジ時間 8,063 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,312 KB
testcase_01 AC 73 ms
71,516 KB
testcase_02 AC 73 ms
71,728 KB
testcase_03 AC 73 ms
71,496 KB
testcase_04 AC 72 ms
71,664 KB
testcase_05 AC 75 ms
71,516 KB
testcase_06 AC 74 ms
71,516 KB
testcase_07 AC 74 ms
71,724 KB
testcase_08 AC 73 ms
71,580 KB
testcase_09 AC 74 ms
71,340 KB
testcase_10 AC 75 ms
71,528 KB
testcase_11 AC 73 ms
71,584 KB
testcase_12 AC 72 ms
71,728 KB
testcase_13 AC 74 ms
71,636 KB
testcase_14 AC 133 ms
77,644 KB
testcase_15 AC 152 ms
77,680 KB
testcase_16 AC 130 ms
77,544 KB
testcase_17 AC 74 ms
71,476 KB
testcase_18 AC 137 ms
77,904 KB
testcase_19 AC 153 ms
77,936 KB
testcase_20 AC 163 ms
77,812 KB
testcase_21 AC 140 ms
77,648 KB
testcase_22 AC 115 ms
77,416 KB
testcase_23 AC 141 ms
77,324 KB
testcase_24 AC 127 ms
77,824 KB
testcase_25 AC 132 ms
77,604 KB
testcase_26 AC 159 ms
77,960 KB
testcase_27 AC 153 ms
77,596 KB
testcase_28 AC 153 ms
77,852 KB
testcase_29 AC 150 ms
77,644 KB
testcase_30 AC 98 ms
76,940 KB
testcase_31 AC 82 ms
71,524 KB
testcase_32 AC 130 ms
77,636 KB
testcase_33 AC 149 ms
77,840 KB
testcase_34 AC 134 ms
77,832 KB
testcase_35 AC 146 ms
77,656 KB
testcase_36 AC 100 ms
76,972 KB
testcase_37 AC 145 ms
77,804 KB
testcase_38 AC 142 ms
77,864 KB
testcase_39 AC 123 ms
77,800 KB
testcase_40 AC 162 ms
77,824 KB
testcase_41 AC 128 ms
77,576 KB
testcase_42 AC 154 ms
77,576 KB
testcase_43 AC 138 ms
77,976 KB
testcase_44 AC 151 ms
77,836 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
P,Q=map(int,input().split())
N=int(input())
res=0
if P+Q==0:
    for i in range(N):
        X,Y=map(int,input().split())
        if X==0 and Y==0:
            res+=1
    print(res)
    exit()
g=math.gcd(P,Q)
P//=g
Q//=g
for i in range(N):
    X,Y=map(int,input().split())
    X=abs(X)
    Y=abs(Y)
    if X%g==0 and Y%g==0:
        X//=g
        Y//=g
        if P%2 and Q%2:
            if (X+Y)%2==0:
                res+=1
        else:
            res+=1
print(res)


0