結果
問題 |
No.321 (P,Q)-サンタと街の子供たち
|
ユーザー |
![]() |
提出日時 | 2018-11-16 23:02:43 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 667 bytes |
コンパイル時間 | 1,268 ms |
コンパイル使用メモリ | 90,584 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 14:18:01 |
合計ジャッジ時間 | 5,295 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | AC * 5 WA * 36 |
ソースコード
#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; }