結果
問題 | No.457 (^^*) |
ユーザー |
![]() |
提出日時 | 2017-01-26 17:35:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 172 ms / 2,000 ms |
コード長 | 807 bytes |
コンパイル時間 | 297 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 71,424 KB |
最終ジャッジ日時 | 2024-12-23 11:42:29 |
合計ジャッジ時間 | 1,988 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
s = input() left = "(^^*)" right = "(*^^)" ans = 0 i = 0 while i < len(s): if s[i] == '(': add = 0 while i < len(s) and s[i] == '(': i += 1 add += 1 state = 1 for j in range(i,len(s)): if state < len(left)-1 and s[j] == left[state]: state += 1 elif s[j] == left[state]: ans += add i += 1 print(ans,end=" ") ans = 0 i = 0 while i < len(s): if s[i] == '(': add = 0 while i < len(s) and s[i] == '(': i += 1 add += 1 state = 1 for j in range(i,len(s)): if state < len(right)-1 and s[j] == right[state]: state += 1 elif s[j] == right[state]: ans += add i += 1 print(ans)