結果

問題 No.118 門松列(2)
ユーザー motimoti
提出日時 2018-05-21 22:26:27
言語 Perl
(5.38.2)
結果
AC  
実行時間 87 ms / 5,000 ms
コード長 424 bytes
コンパイル時間 526 ms
コンパイル使用メモリ 7,052 KB
実行使用メモリ 13,576 KB
最終ジャッジ日時 2023-09-11 01:05:58
合計ジャッジ時間 2,853 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
5,496 KB
testcase_01 AC 87 ms
13,544 KB
testcase_02 AC 86 ms
13,092 KB
testcase_03 AC 85 ms
13,216 KB
testcase_04 AC 87 ms
13,576 KB
testcase_05 AC 87 ms
13,432 KB
testcase_06 AC 5 ms
4,900 KB
testcase_07 AC 5 ms
5,108 KB
testcase_08 AC 5 ms
4,900 KB
testcase_09 AC 86 ms
12,884 KB
testcase_10 AC 64 ms
6,664 KB
testcase_11 AC 64 ms
7,320 KB
testcase_12 AC 60 ms
6,012 KB
testcase_13 AC 59 ms
5,768 KB
testcase_14 AC 86 ms
12,744 KB
testcase_15 AC 56 ms
4,916 KB
testcase_16 AC 72 ms
9,460 KB
testcase_17 AC 58 ms
5,452 KB
testcase_18 AC 64 ms
7,320 KB
testcase_19 AC 70 ms
8,756 KB
testcase_20 AC 70 ms
9,176 KB
testcase_21 AC 78 ms
11,536 KB
testcase_22 AC 61 ms
6,556 KB
testcase_23 AC 78 ms
10,996 KB
testcase_24 AC 65 ms
7,472 KB
testcase_25 AC 69 ms
8,688 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

#!/usr/bin/env perl

use strict;
use warnings;

my $n = <>; chomp $n;
my %h;
my @v;
my $s = <>; chomp $s;
for my $x (split / /,$s) {
  if (!exists$h{$x}) {
    push @v, $x;
  }
  $h{$x}++;
}
my $count = 0;
for (my $i = 0; $i < @v; $i++) {
  for (my $j = 0; $j < $i; $j++) {
    for (my $k = 0; $k < $j; $k++) {
      $count += $h{$v[$i]} * $h{$v[$j]} * $h{$v[$k]};
      $count %= 1000000007;
    }
  }
}

print "$count\n";
0