結果

問題 No.256 桁の数字を入れ替え (2)
ユーザー jjjj
提出日時 2017-03-20 04:51:33
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 687 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 29,724 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-18 08:21:27
合計ジャッジ時間 700 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 27 ms
4,380 KB
testcase_03 AC 26 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.f90:8:28:

   write(cformat(2:7),'(i0)'),len
                            1
Warning: Legacy Extension: Comma before i/o item list at (1)

ソースコード

diff #

program main
  character(len=100000)::str
  integer::len
  integer,allocatable::a(:),b(:)
  character*32::cformat='(      i1)'
  read *, str
  len = LEN_TRIM(str)
  write(cformat(2:7),'(i0)'),len
  allocate(a(len))
  read(str,cformat) a
  b = qsortr(a)
  write(*,cformat)b
contains
  recursive function qsortr(x) result(y)
    integer*4,intent(in) ::x(:)
    integer*4,allocatable::y(:)
    integer*4::pivot,total
    total = size(x)
    if (total <=1) then
       y = x
    else
       pivot = x(total/2)
       y = [qsortr(pack(x, x .gt. pivot)), &
            pack(x, x .eq. pivot),        &
            qsortr(pack(x, x .lt. pivot))]
    endif
  end function qsortr
end program main
0