結果

問題 No.118 門松列(2)
ユーザー jjjj
提出日時 2016-09-17 00:35:46
言語 Fortran
(gFortran 13.2.0)
結果
WA  
実行時間 -
コード長 561 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 32,512 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-28 15:14:38
合計ジャッジ時間 1,038 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

program main
  implicit none
  integer::N,dist(1:100),i,j,total,res,res2
  integer,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