結果

問題 No.178 美しいWhitespace (1)
ユーザー mai
提出日時 2016-01-31 17:06:48
言語 Ruby
(3.4.1)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 174 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 14,848 KB
最終ジャッジ日時 2024-09-21 19:41:11
合計ジャッジ時間 3,260 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:10: 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.to_i
q=[];
while cin=gets
    x,y=cin.split(" ").map(&:to_i)
    q+=[x+y*4];
end
t=q.max
p q.inject(0){|s,e|
    if (t-e)%2==1
        p -1;exit
    end
    s+(t-e)/2}
0