結果
問題 | No.495 (^^*) Easy |
ユーザー |
![]() |
提出日時 | 2017-05-04 08:27:02 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 110 ms / 2,000 ms |
コード長 | 682 bytes |
コンパイル時間 | 2,615 ms |
コンパイル使用メモリ | 79,148 KB |
実行使用メモリ | 40,376 KB |
最終ジャッジ日時 | 2024-09-14 06:17:30 |
合計ジャッジ時間 | 3,787 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import static java.lang.System.in;public class Main {public static void main(String[] args) throws IOException {BufferedReader reader = new BufferedReader(new InputStreamReader(in));String S = reader.readLine();int left = 0;int right = 0;for (int i = 0; i < S.length(); i++) {if(S.charAt(i) == ')') {if(S.charAt(i-1) =='*') {left+=1;} else {right+=1;}}}System.out.println(left +" " + right);}}