結果

問題 No.397 NO MORE KADOMATSU
ユーザー jjjj
提出日時 2017-01-11 22:09:35
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 26,928 KB
実行使用メモリ 24,312 KB
平均クエリ数 936.56
最終ジャッジ日時 2023-09-24 00:50:00
合計ジャッジ時間 1,827 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,784 KB
testcase_01 AC 20 ms
23,676 KB
testcase_02 AC 20 ms
23,976 KB
testcase_03 AC 22 ms
23,520 KB
testcase_04 AC 19 ms
23,652 KB
testcase_05 AC 21 ms
23,388 KB
testcase_06 AC 24 ms
24,312 KB
testcase_07 AC 23 ms
23,352 KB
testcase_08 AC 21 ms
23,376 KB
testcase_09 AC 20 ms
23,364 KB
testcase_10 AC 47 ms
24,192 KB
testcase_11 AC 20 ms
23,340 KB
testcase_12 AC 27 ms
23,808 KB
testcase_13 AC 30 ms
23,808 KB
testcase_14 AC 30 ms
23,796 KB
testcase_15 AC 34 ms
23,388 KB
testcase_16 AC 20 ms
24,288 KB
testcase_17 AC 20 ms
24,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  integer::N,i,j,tmp,count
  integer::A(100)
  integer::swaps(5000)
  data swaps/5000*-1/,count/0/

  read *, N
  read *,A(1:N)

  do i=1, N-1
     do j=1, N-i
        if(A(j).gt.A(j+1)) then
           tmp = A(j+1)
           A(j+1) = A(j)
           A(j) = tmp
           count = count + 1
           swaps(count) = j
        end if
     end do
  end do
  print '(i0)',count
  do i=1,count
     print '(i0," ",i0)',swaps(i)-1,swaps(i)
  end do
end program
0