結果

問題 No.495 (^^*) Easy
ユーザー あsdfあsdf
提出日時 2017-04-01 23:10:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 237 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 2,114 ms
コンパイル使用メモリ 73,384 KB
実行使用メモリ 57,308 KB
最終ジャッジ日時 2023-09-22 02:28:25
合計ジャッジ時間 4,122 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
56,624 KB
testcase_01 AC 150 ms
56,656 KB
testcase_02 AC 150 ms
57,064 KB
testcase_03 AC 153 ms
57,076 KB
testcase_04 AC 156 ms
56,808 KB
testcase_05 AC 167 ms
56,696 KB
testcase_06 AC 237 ms
57,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner cs = new Scanner(System.in);
    String a = cs.next();
    
    int cnt = 0;
    int left = 0;
    int right = 0;

    for(int i = 0;i < a.length();i++){
      if(a.charAt(i) == '*'){
        if(a.charAt(i-1) == '^'){
          left++;
        }else if(a.charAt(i-1) == '('){
          right++;
        }
      }
    }
      System.out.println(left+" "+right);
  }
}
0