結果

問題 No.275 中央値を求めよ
ユーザー concon
提出日時 2018-10-29 18:20:06
言語 Fortran
(gFortran 14.2.0)
結果
AC  
実行時間 4 ms / 1,000 ms
コード長 499 bytes
コンパイル時間 1,051 ms
コンパイル使用メモリ 32,896 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-25 01:59:23
合計ジャッジ時間 2,637 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

program heikin
integer(8) a,n,s
real(8) b
real(8),allocatable :: x(:)
read(*,*) n
allocate (x(n))
read(*,*) (x(m),m=1,n)
call mat(x,n)
if (mod(n,2)==1) then
   s=int(n/2)
   s=s+1
   write(*,*) x(s)
else
   s=n/2
   b=(x(s)+x(s+1))/2
   write(*,*) b
end if
end program

subroutine mat(x,n)
integer(8) n,j,i,t
real(8),dimension(n) ::x
  do i=1,n-1
     do j=i+1,n
        if(x(i) > x(j))then
           t=x(i)
           x(i)=x(j)
           x(j)=t
        end if
     end do
  end do
end subroutine 
0