結果

問題 No.118 門松列(2)
ユーザー jjjj
提出日時 2016-09-17 00:36:32
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 14 ms / 5,000 ms
コード長 565 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 32,640 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 15:14:40
合計ジャッジ時間 960 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 14 ms
5,376 KB
testcase_02 AC 14 ms
5,376 KB
testcase_03 AC 13 ms
5,376 KB
testcase_04 AC 14 ms
5,376 KB
testcase_05 AC 14 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 13 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 12 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 8 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 4 ms
5,376 KB
testcase_19 AC 6 ms
5,376 KB
testcase_20 AC 7 ms
5,376 KB
testcase_21 AC 10 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 9 ms
5,376 KB
testcase_24 AC 4 ms
5,376 KB
testcase_25 AC 7 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  integer*8::N,dist(1:100),i,j,total,res,res2
  integer*8,allocatable::A(:)
  data dist/100*0/,total/0/
  read *,N
  allocate(A(N))
  read *,A
  do i=1, N
     dist(A(i)) = dist(A(i)) + 1
  end do

  res = N
  do i=1,100
     if(dist(i).eq.0) cycle
     res = res - dist(i)
     res2 = res
     do j=i+1,100
        if(dist(j).eq.0) cycle
        res2 = res2 - dist(j)
        total = total + dist(i)*dist(j)*res2
        total = MOD(total,10**9+7)
        if(res2.eq.0) exit
     end do
  end do
  print '(i0)', total
end program main
0