結果
問題 |
No.457 (^^*)
|
ユーザー |
![]() |
提出日時 | 2016-12-08 23:26:18 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,259 bytes |
コンパイル時間 | 1,989 ms |
コンパイル使用メモリ | 32,256 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-28 15:34:03 |
合計ジャッジ時間 | 2,923 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 WA * 5 |
ソースコード
program main implicit none character*10000::S integer::numr=0,numr2,len integer::left=0,right=0 integer::i,j,status read *,S len = LEN_TRIM(S) do i=1,len if(S(i:i)==')') then numr = numr + 1 end if end do do i=1,len if(S(i:i)==')') then numr = numr - 1 if(numr.eq.0) exit cycle else if(S(i:i)/='(') then cycle end if numr2 = numr status = 0 do j=i+1,len if(S(j:j)==')') then numr2 = numr2 - 1 if(numr.eq.0) exit else if(S(j:j)=='^') then status = status + 1 else if(S(j:j)=='*') then if(status >= 2) then left = left + numr2 exit end if end if end do numr2 = numr status = 0 do j=i+1,len if(S(j:j)==')') then numr2 = numr2 - 1 if(numr.eq.0) exit else if(S(j:j)=='^') then status = status * 2 if(status == 4) then right = right + numr2 end if else if(S(j:j)=='*') then if(status == 0) then status = 1 end if end if end do end do print '(i0," ",i0)',left, right end program main