結果
問題 | No.321 (P,Q)-サンタと街の子供たち |
ユーザー |
|
提出日時 | 2021-09-14 01:23:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 136 ms / 2,000 ms |
コード長 | 484 bytes |
コンパイル時間 | 200 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 76,928 KB |
最終ジャッジ日時 | 2024-06-26 03:32:22 |
合計ジャッジ時間 | 5,769 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 41 |
ソースコード
import mathP,Q=map(int,input().split())N=int(input())res=0if P+Q==0:for i in range(N):X,Y=map(int,input().split())if X==0 and Y==0:res+=1print(res)exit()g=math.gcd(P,Q)P//=gQ//=gfor i in range(N):X,Y=map(int,input().split())X=abs(X)Y=abs(Y)if X%g==0 and Y%g==0:X//=gY//=gif P%2 and Q%2:if (X+Y)%2==0:res+=1else:res+=1print(res)