結果
| 問題 | No.91 赤、緑、青の石 |
| コンテスト | |
| ユーザー |
jj
|
| 提出日時 | 2017-01-27 00:10:43 |
| 言語 | Fortran (gFortran 14.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 913 bytes |
| 記録 | |
| コンパイル時間 | 1,959 ms |
| コンパイル使用メモリ | 42,520 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-07 12:27:26 |
| 合計ジャッジ時間 | 3,010 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 |
ソースコード
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
jj