結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー LeonardoneLeonardone
提出日時 2015-12-15 02:00:59
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 446 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 11,416 KB
実行使用メモリ 15,496 KB
最終ジャッジ日時 2023-10-13 16:59:43
合計ジャッジ時間 7,349 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 74 ms
14,976 KB
testcase_02 AC 74 ms
15,212 KB
testcase_03 AC 72 ms
15,152 KB
testcase_04 WA -
testcase_05 RE -
testcase_06 AC 72 ms
15,096 KB
testcase_07 AC 71 ms
15,260 KB
testcase_08 AC 72 ms
15,220 KB
testcase_09 AC 71 ms
15,208 KB
testcase_10 AC 70 ms
15,116 KB
testcase_11 WA -
testcase_12 AC 69 ms
15,096 KB
testcase_13 AC 70 ms
15,264 KB
testcase_14 WA -
testcase_15 AC 71 ms
15,012 KB
testcase_16 AC 133 ms
15,420 KB
testcase_17 AC 71 ms
14,964 KB
testcase_18 AC 151 ms
15,200 KB
testcase_19 WA -
testcase_20 AC 229 ms
15,300 KB
testcase_21 WA -
testcase_22 AC 95 ms
15,236 KB
testcase_23 AC 68 ms
15,192 KB
testcase_24 AC 106 ms
15,320 KB
testcase_25 WA -
testcase_26 AC 232 ms
15,212 KB
testcase_27 WA -
testcase_28 AC 183 ms
15,132 KB
testcase_29 AC 71 ms
15,140 KB
testcase_30 AC 68 ms
15,156 KB
testcase_31 AC 74 ms
15,016 KB
testcase_32 AC 71 ms
15,012 KB
testcase_33 WA -
testcase_34 AC 130 ms
15,376 KB
testcase_35 WA -
testcase_36 AC 76 ms
15,132 KB
testcase_37 AC 174 ms
15,360 KB
testcase_38 AC 153 ms
15,360 KB
testcase_39 WA -
testcase_40 AC 226 ms
15,228 KB
testcase_41 WA -
testcase_42 AC 214 ms
15,292 KB
testcase_43 AC 148 ms
15,400 KB
testcase_44 AC 194 ms
15,304 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#! ruby
# yukicoder My Practice
# author: Leonardone @ NEETSDKASU

def gs(); gets.chomp; end
def gi(); gets.to_i; end
def gss(); gets.chomp.split; end
def gis(); gss.map(&:to_i); end

# 解説読後
# http://yukicoder.me/problems/849/editorial

P, Q = gis
N = gi

d = P * Q == 0 ? P + Q : P.gcd(Q)

if P == 1 || Q == 1 || d == 1
    puts N
    exit
end

c = 0

N.times do
    x, y = gis.map(&:abs)

    c += 1 if x % d == 0 && y % d == 0
end

p c
0