結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー kimiyukikimiyuki
提出日時 2016-04-19 18:46:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 391 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-04-15 03:45:15
合計ジャッジ時間 8,969 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 34 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 31 ms
10,752 KB
testcase_05 RE -
testcase_06 AC 30 ms
10,880 KB
testcase_07 AC 32 ms
10,752 KB
testcase_08 AC 31 ms
10,880 KB
testcase_09 AC 30 ms
10,752 KB
testcase_10 AC 31 ms
10,752 KB
testcase_11 AC 31 ms
10,880 KB
testcase_12 AC 30 ms
10,752 KB
testcase_13 AC 31 ms
10,752 KB
testcase_14 AC 251 ms
10,752 KB
testcase_15 AC 347 ms
10,880 KB
testcase_16 AC 146 ms
10,880 KB
testcase_17 AC 31 ms
10,752 KB
testcase_18 AC 174 ms
10,752 KB
testcase_19 AC 227 ms
10,752 KB
testcase_20 AC 316 ms
10,752 KB
testcase_21 AC 240 ms
10,880 KB
testcase_22 AC 80 ms
10,880 KB
testcase_23 AC 291 ms
10,752 KB
testcase_24 AC 94 ms
10,752 KB
testcase_25 AC 189 ms
10,752 KB
testcase_26 AC 312 ms
10,752 KB
testcase_27 AC 247 ms
10,752 KB
testcase_28 AC 242 ms
10,880 KB
testcase_29 AC 357 ms
10,880 KB
testcase_30 AC 37 ms
11,008 KB
testcase_31 AC 33 ms
10,880 KB
testcase_32 AC 194 ms
10,880 KB
testcase_33 AC 185 ms
10,880 KB
testcase_34 AC 139 ms
11,008 KB
testcase_35 AC 297 ms
10,752 KB
testcase_36 AC 39 ms
10,880 KB
testcase_37 AC 215 ms
10,880 KB
testcase_38 AC 181 ms
10,752 KB
testcase_39 AC 82 ms
10,880 KB
testcase_40 AC 315 ms
10,752 KB
testcase_41 AC 118 ms
10,752 KB
testcase_42 AC 273 ms
10,880 KB
testcase_43 AC 150 ms
10,752 KB
testcase_44 AC 245 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import math
p, q = map(int,input().split())
n = int(input())
gcd = math.gcd(p, q)
even = (p / gcd) % 2 == 0 or (q / gcd) % 2 == 0
ans = 0
for i in range(n):
    x, y = map(int,input().split())
    if x % gcd == 0 and y % gcd == 0:
        if even:
            ans += 1
        else:
            if ((x / gcd) + (y / gcd)) % 2 == 0:
                ans += 1
print(ans)
0