結果

問題 No.118 門松列(2)
ユーザー zazaboonzazaboon
提出日時 2017-05-23 17:01:44
言語 Ruby
(3.3.0)
結果
AC  
実行時間 281 ms / 5,000 ms
コード長 364 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 11,844 KB
実行使用メモリ 24,404 KB
最終ジャッジ日時 2023-10-19 15:32:48
合計ジャッジ時間 8,125 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 230 ms
16,268 KB
testcase_01 AC 281 ms
24,396 KB
testcase_02 AC 273 ms
24,200 KB
testcase_03 AC 274 ms
24,296 KB
testcase_04 AC 278 ms
24,396 KB
testcase_05 AC 275 ms
24,404 KB
testcase_06 AC 229 ms
16,196 KB
testcase_07 AC 226 ms
16,196 KB
testcase_08 AC 223 ms
16,196 KB
testcase_09 AC 271 ms
21,464 KB
testcase_10 AC 231 ms
17,148 KB
testcase_11 AC 240 ms
18,836 KB
testcase_12 AC 232 ms
17,164 KB
testcase_13 AC 225 ms
16,316 KB
testcase_14 AC 268 ms
21,548 KB
testcase_15 AC 228 ms
16,184 KB
testcase_16 AC 249 ms
20,900 KB
testcase_17 AC 232 ms
16,300 KB
testcase_18 AC 241 ms
18,836 KB
testcase_19 AC 247 ms
20,196 KB
testcase_20 AC 248 ms
20,528 KB
testcase_21 AC 261 ms
21,248 KB
testcase_22 AC 234 ms
17,172 KB
testcase_23 AC 255 ms
21,360 KB
testcase_24 AC 238 ms
18,788 KB
testcase_25 AC 248 ms
19,860 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:5: warning: assigned but unused variable - n
Main.rb:9: warning: assigned but unused variable - low
Main.rb:12: warning: assigned but unused variable - sum
Syntax OK

ソースコード

diff #

# Here your code !
def jj(a,b,c)
  (a > b and c > a)
end
n = gets.chomp.to_i
a = gets.chomp.split.map &:to_i
aa = Array.new(101,0)
a.each{|d|aa[d] += 1}
low = 0
ans = 0
c = aa.count{|d| d!=0}
sum = c
aa.each.with_index do |d,i|
  aa.each.with_index do |dd,j|
    aa.each.with_index do |ddd,k|
      ans += d*dd*ddd if(jj(i,j,k))
    end
  end
end
p ans % (10**9+7)
0