結果

問題 No.495 (^^*) Easy
ユーザー 37zigen37zigen
提出日時 2017-03-24 22:58:17
言語 Java19
(openjdk 21)
結果
AC  
実行時間 237 ms / 2,000 ms
コード長 479 bytes
コンパイル時間 4,437 ms
コンパイル使用メモリ 73,580 KB
実行使用メモリ 59,576 KB
最終ジャッジ日時 2023-09-20 02:39:12
合計ジャッジ時間 6,579 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
56,576 KB
testcase_01 AC 143 ms
56,876 KB
testcase_02 AC 144 ms
56,836 KB
testcase_03 AC 147 ms
57,268 KB
testcase_04 AC 146 ms
56,568 KB
testcase_05 AC 162 ms
56,556 KB
testcase_06 AC 237 ms
59,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String l = "(^^*)";
		String r = "(*^^)";
		int cntL = 0, cntR = 0;
		for (int i = 0; i + 5 < S.length(); i += 5) {
			if (S.substring(i, i + 5).equals(l)) {
				++cntL;
			} else if (S.substring(i, i + 5).equals(r)) {
				++cntR;
			}
		}
		System.out.println(cntL + " " + cntR);
	}

}
0