結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 33 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 31 ms
10,752 KB
testcase_08 AC 30 ms
10,752 KB
testcase_09 AC 31 ms
10,880 KB
testcase_10 AC 31 ms
10,752 KB
testcase_11 AC 31 ms
10,880 KB
testcase_12 AC 31 ms
10,752 KB
testcase_13 AC 31 ms
10,880 KB
testcase_14 AC 244 ms
10,880 KB
testcase_15 AC 345 ms
10,880 KB
testcase_16 AC 144 ms
10,880 KB
testcase_17 AC 32 ms
10,752 KB
testcase_18 AC 174 ms
10,752 KB
testcase_19 AC 229 ms
10,752 KB
testcase_20 AC 331 ms
10,880 KB
testcase_21 AC 236 ms
10,880 KB
testcase_22 AC 82 ms
10,752 KB
testcase_23 AC 291 ms
10,752 KB
testcase_24 AC 95 ms
10,752 KB
testcase_25 AC 197 ms
10,752 KB
testcase_26 AC 319 ms
10,752 KB
testcase_27 AC 244 ms
10,752 KB
testcase_28 AC 242 ms
10,752 KB
testcase_29 AC 356 ms
10,880 KB
testcase_30 AC 37 ms
10,752 KB
testcase_31 AC 33 ms
10,752 KB
testcase_32 AC 198 ms
10,880 KB
testcase_33 AC 189 ms
10,880 KB
testcase_34 AC 139 ms
10,752 KB
testcase_35 AC 304 ms
10,880 KB
testcase_36 AC 39 ms
10,752 KB
testcase_37 AC 214 ms
10,880 KB
testcase_38 AC 178 ms
10,752 KB
testcase_39 AC 81 ms
10,752 KB
testcase_40 AC 311 ms
10,752 KB
testcase_41 AC 117 ms
10,880 KB
testcase_42 AC 278 ms
10,752 KB
testcase_43 AC 148 ms
10,752 KB
testcase_44 AC 253 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import math
p, q = map(int,input().split())
n = int(input())
if p == 0 or q == 0:
    gcd = p + q
    even = True
else:
    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