結果

問題 No.754 畳み込みの和
ユーザー 👑 horiesinitihoriesiniti
提出日時 2018-03-19 15:08:07
言語 Ruby
(3.3.0)
結果
AC  
実行時間 267 ms / 5,000 ms
コード長 194 bytes
コンパイル時間 57 ms
コンパイル使用メモリ 11,392 KB
実行使用メモリ 18,088 KB
最終ジャッジ日時 2023-08-30 03:37:43
合計ジャッジ時間 1,969 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 262 ms
17,940 KB
testcase_01 AC 267 ms
17,792 KB
testcase_02 AC 262 ms
18,088 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i+1
as=[]
bs=[]
n.times{
	as<<gets.to_i
}
as=as.reverse
n.times{
	bs<<gets.to_i
}

sum=as.inject{|sum,e|
	sum+e
}
ans=0
bs.each{|e|
	ans=(ans+sum*e)%(10**9+7)
	sum-=as.shift
}
puts ans
0