結果

問題 No.495 (^^*) Easy
ユーザー samplelpmassamplelpmas
提出日時 2017-04-09 19:00:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 625 bytes
コンパイル時間 2,064 ms
コンパイル使用メモリ 73,808 KB
実行使用メモリ 58,288 KB
最終ジャッジ日時 2023-09-25 01:28:01
合計ジャッジ時間 3,927 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 146 ms
56,536 KB
testcase_01 AC 147 ms
56,360 KB
testcase_02 AC 146 ms
56,700 KB
testcase_03 AC 148 ms
56,884 KB
testcase_04 AC 150 ms
56,784 KB
testcase_05 AC 163 ms
57,008 KB
testcase_06 AC 230 ms
58,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        char[] emoticons = sc.next().toCharArray();

        int countLeft = 0;
        int countRight = 0;

        for (int i = 0; i < emoticons.length; i++) {

            if (emoticons[i] == '*') {

                if (emoticons[i + 1] == ')') {
                    countLeft ++;
                } else if (emoticons[i + 1] == '^'){
                    countRight ++;
                }

            }

        }

        System.out.println(countLeft + " " + countRight);

    }

}
0