結果

問題 No.321 (P,Q)-サンタと街の子供たち
ユーザー cielciel
提出日時 2015-12-14 02:09:37
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 366 bytes
コンパイル時間 64 ms
コンパイル使用メモリ 11,532 KB
実行使用メモリ 15,544 KB
最終ジャッジ日時 2023-10-13 16:04:25
合計ジャッジ時間 6,142 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,312 KB
testcase_01 RE -
testcase_02 AC 82 ms
15,148 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 84 ms
15,048 KB
testcase_06 AC 84 ms
15,196 KB
testcase_07 AC 82 ms
15,140 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 82 ms
15,260 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 82 ms
15,152 KB
testcase_14 RE -
testcase_15 AC 201 ms
15,404 KB
testcase_16 AC 131 ms
15,304 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 105 ms
15,412 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

#!/usr/bin/ruby
a,b=gets.split.map(&:to_i).sort
if b==0
	gets;p $<.count{|e|
		x,y=e.split.map(&:to_i)
		x==0&&y==0
	}
elsif a==0
	gets;p $<.count{|e|
		x,y=e.split.map(&:to_i)
		x%b==0&&y%b==0
	}
else
	g=a.gcd b
	a/=g
	b/=g
	gets;p $<.count{|e|
		x,y=e.split.map{|e|e.to_i.abs}.sort
		next if x%g!=0 || y%g!=0
		raise
		x/=g
		y/=g
		y%(b-a)==0 && x%(b-a)==0
	}
end
0