結果
問題 |
No.321 (P,Q)-サンタと街の子供たち
|
ユーザー |
|
提出日時 | 2022-03-02 12:02:44 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 380 bytes |
コンパイル時間 | 141 ms |
コンパイル使用メモリ | 82,356 KB |
実行使用メモリ | 76,848 KB |
最終ジャッジ日時 | 2024-07-16 05:46:42 |
合計ジャッジ時間 | 4,805 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 31 WA * 10 |
ソースコード
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) 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: ans += 1 print(ans)