結果
問題 |
No.321 (P,Q)-サンタと街の子供たち
|
ユーザー |
![]() |
提出日時 | 2018-11-16 23:04:04 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 667 bytes |
コンパイル時間 | 1,105 ms |
コンパイル使用メモリ | 90,548 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 14:18:06 |
合計ジャッジ時間 | 4,083 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 31 WA * 10 |
ソースコード
#include <cstdio> #include <cstring> #include <string> #include <iostream> #include <cmath> #include <bitset> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #include <unordered_map> #include <unordered_set> #include <random> using namespace std; typedef long long int ll; typedef pair<int, int> P; ll gcd(ll a, ll b){ if(b==0) return a; return gcd(b, a%b); } int main() { ll p, q; cin>>p>>q; ll d=gcd(p, q); int n; cin>>n; int ct=0; for(int i=0; i<n; i++){ ll x, y; cin>>x>>y; if(p==0 && q==0){ if(x==0 && y==0) ct++; }else{ if(x%d==0 && y%d==0) ct++; } } cout<<ct<<endl; return 0; }