結果
問題 |
No.816 Beautiful tuples
|
ユーザー |
|
提出日時 | 2019-04-19 21:27:09 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 280 bytes |
コンパイル時間 | 43 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-09-22 16:27:53 |
合計ジャッジ時間 | 2,025 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 WA * 4 |
コンパイルメッセージ
Main.rb:17: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
a, b = gets.split.map(&:to_i) s = a+b ans = [] (1..s).each do |i| break if i*i > s next if s % i > 0 [i, s/i].each do |c| if (b+c) % a == 0 && (c+a) % b == 0 ans.push(c) end end end if ans.size > 0 puts ans.min else puts -1 end