結果

問題 No.983 Convolution
ユーザー wonda_t_coffeewonda_t_coffee
提出日時 2020-02-11 13:45:41
言語 Ruby
(3.4.1)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 117 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 26,880 KB
最終ジャッジ日時 2024-10-01 07:25:15
合計ジャッジ時間 4,987 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:5: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i) - [-1]

if a.empty?
  puts -1
else
  puts a.inject(&:gcd)**2
end
0