結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
15,140 KB
testcase_01 AC 81 ms
15,192 KB
testcase_02 AC 81 ms
15,056 KB
testcase_03 AC 82 ms
15,224 KB
testcase_04 WA -
testcase_05 AC 82 ms
15,188 KB
testcase_06 AC 81 ms
15,152 KB
testcase_07 AC 80 ms
15,312 KB
testcase_08 AC 81 ms
15,184 KB
testcase_09 AC 81 ms
15,152 KB
testcase_10 AC 80 ms
15,160 KB
testcase_11 WA -
testcase_12 AC 81 ms
15,256 KB
testcase_13 AC 82 ms
15,148 KB
testcase_14 WA -
testcase_15 AC 83 ms
15,192 KB
testcase_16 AC 153 ms
15,344 KB
testcase_17 AC 80 ms
15,140 KB
testcase_18 AC 168 ms
15,320 KB
testcase_19 WA -
testcase_20 AC 265 ms
15,344 KB
testcase_21 WA -
testcase_22 AC 113 ms
15,184 KB
testcase_23 AC 82 ms
15,268 KB
testcase_24 AC 121 ms
15,264 KB
testcase_25 WA -
testcase_26 AC 256 ms
15,260 KB
testcase_27 WA -
testcase_28 AC 208 ms
15,256 KB
testcase_29 AC 80 ms
15,060 KB
testcase_30 AC 81 ms
15,064 KB
testcase_31 AC 84 ms
15,060 KB
testcase_32 AC 83 ms
15,164 KB
testcase_33 WA -
testcase_34 AC 148 ms
15,328 KB
testcase_35 WA -
testcase_36 AC 90 ms
15,276 KB
testcase_37 AC 193 ms
15,276 KB
testcase_38 AC 174 ms
15,292 KB
testcase_39 WA -
testcase_40 AC 253 ms
15,292 KB
testcase_41 WA -
testcase_42 AC 229 ms
15,248 KB
testcase_43 AC 154 ms
15,328 KB
testcase_44 AC 216 ms
15,308 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)
    
    if P == 0 && Q == 0
        c += 1 if x == 0 && y == 0
        next
    end
    
    c += 1 if x % d == 0 && y % d == 0
end

p c
0