結果
| 問題 | No.321 (P,Q)-サンタと街の子供たち |
| コンテスト | |
| ユーザー |
kura07
|
| 提出日時 | 2015-12-14 23:30:15 |
| 言語 | Ruby (4.0.2) |
| 結果 |
AC
|
| 実行時間 | 182 ms / 2,000 ms |
| コード長 | 394 bytes |
| 記録 | |
| コンパイル時間 | 225 ms |
| コンパイル使用メモリ | 8,960 KB |
| 実行使用メモリ | 15,104 KB |
| 最終ジャッジ日時 | 2026-03-28 12:04:53 |
| 合計ジャッジ時間 | 5,912 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 41 |
コンパイルメッセージ
Syntax OK
ソースコード
p, q = gets.split.map(&:to_i).map(&:abs)
if [p,q]==[0,0]
type = 0
else
gcd = p.gcd(q)
p /= gcd; q /= gcd
type = (p*q).odd? ? 1 : 2
end
puts gets.to_i.times.count{
x, y = gets.split.map(&:to_i).map(&:abs)
if type == 0
next [x,y]==[0,0]
else
next false if x % gcd != 0 || y % gcd != 0
x /= gcd; y /= gcd
case type
when 1
next (x+y).even?
when 2
next true
end
end
}
kura07