結果

問題 No.133 カードゲーム
ユーザー jjjj
提出日時 2016-07-29 18:33:20
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,502 bytes
コンパイル時間 1,946 ms
コンパイル使用メモリ 29,224 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-07 09:25:51
合計ジャッジ時間 2,949 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

program main
  integer::N
  integer::A(4),B(4)
  integer::AA(4,24),BB(4,24)
  integer::AAA(24)
  integer::i,j,k,l,indx = 0,total=0,pat=1

  read *,N
  read *,A(1:N), B(1:N)
  do i=1,N
     if(N.eq.1) then
        indx = indx + 1
        AA(1,indx) = A(i)
        BB(1,indx) = B(i)
        cycle
     end if
     do j=1,N
        if(i.eq.j) cycle
        if(N.eq.2) then
           indx = indx + 1
           AA(1:2,indx) = (/A(i),A(j)/)
           BB(1:2,indx) = (/B(i),B(j)/)
           cycle
        end if
        do k=1,N
           if(i.eq.k) cycle
           if(j.eq.k) cycle
           if(N.eq.3) then
              indx = indx + 1
              AA(1:3,indx) = (/A(i),A(j),A(k)/)
              BB(1:3,indx) = (/B(i),B(j),B(k)/)
              cycle
           end if
           do l=1,N
              if(i.eq.l) cycle
              if(j.eq.l) cycle
              if(k.eq.l) cycle
              indx = indx + 1
              AA(1:4,indx) = (/A(i),A(j),A(k),A(l)/)
              BB(1:4,indx) = (/B(i),B(j),B(k),B(l)/)
           end do
        end do
     end do
  end do

  do i=2,N
     pat=pat*i
  end do

  do i=1,pat
     do j=1,pat
        AAA(j) = 0
        do k=1,N
           if ( AA(k,i).gt.BB(k,j) ) then
              AAA(j) = AAA(j) + 1
           else if ( AA(k,i).lt.BB(k,j) ) then
              AAA(j) = AAA(j) - 1
           end if
        end do
     end do
     total = total + COUNT(AAA(1:pat).gt.0)
  end do

  print '(a,f0.2)', '0',REAL(total)/REAL(pat*pat)

end program main
0