結果
| 問題 |
No.457 (^^*)
|
| コンテスト | |
| ユーザー |
jj
|
| 提出日時 | 2016-12-08 23:29:24 |
| 言語 | Fortran (gFortran 14.2.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,265 bytes |
| コンパイル時間 | 1,566 ms |
| コンパイル使用メモリ | 32,128 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-28 15:34:06 |
| 合計ジャッジ時間 | 1,339 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 WA * 5 |
ソースコード
program main
implicit none
character*10000::S
integer*8::numr=0,numr2,len
integer*8::left=0,right=0
integer*8::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
jj