結果
問題 |
No.256 桁の数字を入れ替え (2)
|
ユーザー |
![]() |
提出日時 | 2017-03-20 04:51:33 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
AC
|
実行時間 | 20 ms / 2,000 ms |
コード長 | 687 bytes |
コンパイル時間 | 1,450 ms |
コンパイル使用メモリ | 35,000 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 00:19:27 |
合計ジャッジ時間 | 640 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 |
コンパイルメッセージ
Main.f90:8:28: 8 | write(cformat(2:7),'(i0)'),len | 1 Warning: Legacy Extension: Comma before i/o item list at (1)
ソースコード
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