結果

問題 No.457 (^^*)
ユーザー jjjj
提出日時 2017-01-29 01:33:25
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 813 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 26,888 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 13:37:02
合計ジャッジ時間 1,683 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

program main
  implicit none
  character*10000::S
  character::c
  integer*8::i,j,len
  integer*8::left(5),right(5)
  data left/5*0/,right/5*0/

  read *,S
  len = LEN_TRIM(S)

  do i=1,len
     c = S(i:i)
     if(c.eq.'(') then
        left(1) = left(1) + 1
        right(1) = right(1) + 1
     else if(c.eq.'^') then
        left(3) = left(3) + left(2)
        left(2) = left(1)
        left(1) = 0
        right(4) = right(4) + right(3)
        right(3) = right(2)
        right(2) = 0
     else if(c.eq.'*') then
        left(4) = left(4) + left(3)
        left(3) = 0
        right(2) = right(2) + right(1)
        right(1) = 0
     else if(c.eq.')') then
        left(5) = left(5) + left(4)
        right(5) = right(5) + right(4)
     end if
  end do
  print '(i0," ",i0)',left(5), right(5)
end program main
0