結果

問題 No.91 赤、緑、青の石
ユーザー jjjj
提出日時 2017-01-27 00:10:43
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 913 bytes
コンパイル時間 1,241 ms
コンパイル使用メモリ 26,640 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-06 12:25:15
合計ジャッジ時間 2,418 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  integer*8::r,g,b,tmp,diff
  integer*8::i,j
  data j/0/
  read *,r,g,b
  j=MIN(MIN(r,g),b)
  r = r - j
  g = g - j
  b = b - j
  call sort(r,g,b)
  if(r.eq.0) then
     print '(i0)',j
     return
  else if(g.eq.0) then
     print '(i0)',j+r/4
     return
  end if
  if(r.ge.3*g) then
     print '(i0)',j+g+(r-3*g)/5
     return
  end if
  diff = (r - g)/2
  j = j + diff
  r = r - 3*diff
  g = g - diff
  diff = MIN(r,g)/4
  j = j + diff*2
  r = r - diff*4
  g = g - diff*4
  call sort(r,g,b)
  if(r.ge.3.and.g.ge.1) then
     j = j + 1
  end if
  print '(i0)',j
contains
  subroutine sort(r,g,b)
    integer*8::r,g,b,tmp
    if(r.lt.g) then
       tmp = g
       g = r
       r = tmp
    end if
    if(g.lt.b) then
       tmp = g
       g = b
       b = tmp
    end if
    if(r.lt.g) then
       tmp = g
       g = r
       r = tmp
    end if
  end subroutine sort
end program main
0