結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー sssr1031sssr1031
提出日時 2022-07-01 18:25:10
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 316 bytes
コンパイル時間 4,060 ms
コンパイル使用メモリ 131,984 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-08-17 05:31:50
合計ジャッジ時間 9,350 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
  ll P, Q;
  cin >> P >> Q;

  int N;
  cin >> N;

  ll g = gcd(P - Q, gcd(Q - P, P + Q));

  int ans = 0;
  while (N--) {
    ll X, Y;
    cin >> X >> Y;

    if ((X + Y) % g == 0) ++ans;
  }

  cout << ans << endl;
  return 0;
}

0