結果

問題 No.126 2基のエレベータ
ユーザー jj
提出日時 2016-08-15 23:11:44
言語 Fortran
(gFortran 14.2.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 438 bytes
コンパイル時間 1,875 ms
コンパイル使用メモリ 30,848 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-10 18:30:36
合計ジャッジ時間 2,798 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  integer::A,B,S,move=0
  read *,A,B,S
  if(A.eq.0) then
     move = move + 1
     A    = 1
  end if

  if(S.eq.1) then
     move = move + A
  else if(ABS(B-S).lt.ABS(A-S)) then
     if(B.lt.A) then
        move = move + ABS(B-S) + MIN((S-1),ABS(A-S)) + A
     else
        move = move + ABS(B-S) + ABS(S-A) + A
     end if
  else
     move = move + ABS(A-S) + S
  end if
  print '(i0)', move
end program main
0