結果
問題 | No.321 (P,Q)-サンタと街の子供たち |
ユーザー | ああいい |
提出日時 | 2022-03-02 12:09:47 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 562 bytes |
コンパイル時間 | 595 ms |
コンパイル使用メモリ | 86,964 KB |
実行使用メモリ | 80,392 KB |
最終ジャッジ日時 | 2023-09-23 05:55:51 |
合計ジャッジ時間 | 9,745 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 79 ms
71,004 KB |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | AC | 79 ms
71,260 KB |
testcase_05 | AC | 80 ms
70,772 KB |
testcase_06 | RE | - |
testcase_07 | AC | 81 ms
71,064 KB |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | AC | 82 ms
71,088 KB |
testcase_11 | AC | 80 ms
71,176 KB |
testcase_12 | AC | 83 ms
71,272 KB |
testcase_13 | AC | 78 ms
71,192 KB |
testcase_14 | AC | 142 ms
77,088 KB |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | AC | 137 ms
77,120 KB |
testcase_20 | RE | - |
testcase_21 | AC | 130 ms
77,184 KB |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | AC | 128 ms
77,156 KB |
testcase_26 | RE | - |
testcase_27 | AC | 144 ms
77,176 KB |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | AC | 134 ms
77,108 KB |
testcase_34 | RE | - |
testcase_35 | AC | 140 ms
77,056 KB |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | RE | - |
testcase_39 | AC | 113 ms
77,476 KB |
testcase_40 | RE | - |
testcase_41 | AC | 121 ms
77,136 KB |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | RE | - |
ソースコード
p,q = map(int,input().split()) N = int(input()) def gcd(a,b): if b == 0:return a while True: r =a % b a = b b = r if r == 0:return a ans = 0 d = gcd(p,q) if d != 0: p //= d q //= d if (p+q) % 2 == 0: flag = True for _ in range(N): x,y = map(int,input().split()) if d == 0: if x == 0 and y == 0:ans += 1 continue if x % d == 0 and y % d == 0: x //= d y //= d if flag: if (x+y)% 2 == 0:ans+= 1 else: ans += 1 print(ans)