結果

問題 No.495 (^^*) Easy
ユーザー jimanojimano
提出日時 2018-01-21 16:59:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 803 bytes
コンパイル時間 4,224 ms
コンパイル使用メモリ 76,604 KB
実行使用メモリ 57,408 KB
最終ジャッジ日時 2023-08-26 19:43:06
合計ジャッジ時間 5,362 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
52,336 KB
testcase_01 AC 76 ms
52,320 KB
testcase_02 AC 83 ms
52,244 KB
testcase_03 AC 86 ms
52,436 KB
testcase_04 AC 86 ms
52,572 KB
testcase_05 AC 98 ms
53,744 KB
testcase_06 AC 166 ms
57,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.lv1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class No0495 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String[] str = br.readLine().split("\\)");
			Map<String, Integer> map = new HashMap<>(); 
			String right = "(*^^";
			String left = "(^^*";
			
			for (String s: str) {
				map.computeIfPresent(s, (k,v) -> map.get(s) + 1);
				map.putIfAbsent(s, 1);
			}
			int cntLeft = map.get(left) !=null ? map.get(left): 0;
			int cntRight= map.get(right) !=null ? map.get(right): 0;
			System.out.println(cntLeft + " " + cntRight);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0