結果
| 問題 |
No.91 赤、緑、青の石
|
| ユーザー |
jj
|
| 提出日時 | 2017-01-27 00:03:45 |
| 言語 | Fortran (gFortran 14.2.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 913 bytes |
| コンパイル時間 | 1,529 ms |
| コンパイル使用メモリ | 31,616 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-23 13:31:16 |
| 合計ジャッジ時間 | 2,693 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 WA * 5 |
ソースコード
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)/4
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.eq.3.and.g.gt.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