結果

問題 No.161 制限ジャンケン
ユーザー jjjj
提出日時 2016-09-05 23:09:19
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 482 bytes
コンパイル時間 1,397 ms
コンパイル使用メモリ 26,124 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-20 04:53:56
合計ジャッジ時間 2,298 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 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,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

program main
  implicit none
  integer::G,C,P,i
  integer::gg,cc,pp
  data gg,cc,pp/3*0/
  character*300::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