結果

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

ソースコード

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(ABS(B-S).lt.ABS(A-S)) then
     if(B.lt.A) then
        move = move + ABS(B-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