結果
問題 |
No.321 (P,Q)-サンタと街の子供たち
|
ユーザー |
![]() |
提出日時 | 2020-11-26 19:30:27 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 84 ms / 2,000 ms |
コード長 | 471 bytes |
コンパイル時間 | 347 ms |
コンパイル使用メモリ | 82,536 KB |
実行使用メモリ | 76,472 KB |
最終ジャッジ日時 | 2024-07-23 20:55:55 |
合計ジャッジ時間 | 4,616 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 41 |
ソースコード
import sys from math import gcd def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) P,Q = MI() g = gcd(P,Q) N = I() ans = 0 for _ in range(N): X,Y = MI() if g == 0: if X == Y == 0: ans += 1 continue if X % g == Y % g == 0: if (P//g+Q//g) % 2 == 0: if (X//g+Y//g) % 2 == 0: ans += 1 else: ans += 1 print(ans)