結果
問題 | No.321 (P,Q)-サンタと街の子供たち |
ユーザー |
![]() |
提出日時 | 2019-04-13 17:37:20 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 145 ms / 2,000 ms |
コード長 | 488 bytes |
コンパイル時間 | 423 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 76,928 KB |
最終ジャッジ日時 | 2024-09-15 11:13:15 |
合計ジャッジ時間 | 7,293 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 41 |
ソースコード
import mathP,Q = list(map(int, input().split()))N = int(input())g = math.gcd(P,Q)if g != 0:P = P // gQ = Q // gcount = 0for _ in range(N):x,y = list(map(int, input().split()))if g == 0:if x == 0 and y == 0:count = count + 1continueif x % g != 0 or y % g != 0:continuex = x // gy = y // gif (P+Q) % 2 == 0 and (x+y) % 2 != 0:continuecount = count + 1print(count)