結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー yuruhiyayuruhiya
提出日時 2021-01-24 14:21:00
言語 Crystal
(1.11.2)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 18,492 ms
コンパイル使用メモリ 255,676 KB
実行使用メモリ 4,952 KB
最終ジャッジ日時 2023-09-13 13:19:38
合計ジャッジ時間 22,897 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,460 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,388 KB
testcase_05 AC 2 ms
4,420 KB
testcase_06 AC 2 ms
4,404 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 2 ms
4,460 KB
testcase_09 AC 2 ms
4,392 KB
testcase_10 AC 2 ms
4,444 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 3 ms
4,452 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 27 ms
4,864 KB
testcase_15 AC 37 ms
4,952 KB
testcase_16 AC 17 ms
4,892 KB
testcase_17 AC 3 ms
4,464 KB
testcase_18 AC 20 ms
4,836 KB
testcase_19 AC 26 ms
4,804 KB
testcase_20 AC 38 ms
4,820 KB
testcase_21 AC 24 ms
4,896 KB
testcase_22 AC 9 ms
4,884 KB
testcase_23 AC 31 ms
4,856 KB
testcase_24 AC 10 ms
4,872 KB
testcase_25 AC 23 ms
4,820 KB
testcase_26 AC 36 ms
4,944 KB
testcase_27 AC 28 ms
4,888 KB
testcase_28 AC 27 ms
4,896 KB
testcase_29 AC 37 ms
4,816 KB
testcase_30 AC 4 ms
4,840 KB
testcase_31 AC 3 ms
4,516 KB
testcase_32 AC 20 ms
4,872 KB
testcase_33 AC 21 ms
4,868 KB
testcase_34 AC 16 ms
4,868 KB
testcase_35 AC 32 ms
4,872 KB
testcase_36 AC 4 ms
4,892 KB
testcase_37 AC 25 ms
4,768 KB
testcase_38 AC 20 ms
4,820 KB
testcase_39 AC 9 ms
4,860 KB
testcase_40 AC 36 ms
4,908 KB
testcase_41 AC 12 ms
4,872 KB
testcase_42 AC 31 ms
4,768 KB
testcase_43 AC 17 ms
4,804 KB
testcase_44 AC 29 ms
4,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

lib C
  fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64
end

class String
  def to_i64
    C.strtoll(self, nil, 10)
  end
end

p, q = read_line.split.map(&.to_i64)
n = read_line.to_i
g = p.gcd(q)
if g > 0
  p //= g
  q //= g
end
puts (0...n).count {
  x, y = read_line.split.map(&.to_i64)
  if g == 0
    {x, y} == {0, 0}
  elsif (p + q).even?
    {x % g, y % g} == {0, 0} && (x // g + y // g).even?
  else
    {x % g, y % g} == {0, 0}
  end
}
0