結果

問題 No.161 制限ジャンケン
ユーザー jjjj
提出日時 2016-09-05 23:05:53
言語 Fortran
(gFortran 13.2.0)
結果
WA  
実行時間 -
コード長 481 bytes
コンパイル時間 1,182 ms
コンパイル使用メモリ 31,872 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-27 16:41:29
合計ジャッジ時間 1,928 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
6,944 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  integer::G,C,P,i
  integer::gg,cc,pp
  data gg,cc,pp/3*0/
  character*30::S
  read *,G,C,P,S
  do i=1,LEN_TRIM(S)
     if(S(i:i).eq.'G') then
        gg = gg + 1
     else if(S(i:i).eq.'C') then
        cc = cc + 1
     else
        pp = pp + 1
     end if
  end do

  print '(i0)',3*(MIN(P,gg)+MIN(G,cc)+MIN(C,pp))+ &
       MIN(MAX(G-cc,0),MAX(gg-P,0))+ &
       MIN(MAX(C-pp,0),MAX(cc-G,0))+ &
       MIN(MAX(P-gg,0),MAX(pp-C,0))
end program main
0