結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー NekosyndromeNekosyndrome
提出日時 2015-12-14 00:19:24
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 802 bytes
コンパイル時間 2,181 ms
コンパイル使用メモリ 143,236 KB
実行使用メモリ 4,476 KB
最終ジャッジ日時 2023-10-13 15:05:54
合計ジャッジ時間 5,237 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 RE -
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 1 ms
4,352 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 AC 28 ms
4,352 KB
testcase_16 AC 12 ms
4,348 KB
testcase_17 WA -
testcase_18 AC 14 ms
4,348 KB
testcase_19 AC 19 ms
4,352 KB
testcase_20 AC 29 ms
4,348 KB
testcase_21 WA -
testcase_22 AC 6 ms
4,352 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}
using namespace std;
typedef long long LL;
int main()
{
	int p,q,gcd;
	int n,x,y;
	int ans;
	while(~scanf("%d %d",&p,&q))
	{
		ans=0;
		gcd = __gcd(p,q);
		RI(n);
		while(n--)
		{
			RI(x,y);
			x = abs(x);
			y = abs(y);
			if(x%gcd==0 && y%gcd==0)
			{
				int diff = abs(p-q);
				if(diff>0 && abs(x-y)%diff==0) ans++;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}
0