結果
問題 | No.495 (^^*) Easy |
ユーザー |
|
提出日時 | 2018-01-21 16:59:33 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 203 ms / 2,000 ms |
コード長 | 803 bytes |
コンパイル時間 | 5,275 ms |
コンパイル使用メモリ | 80,916 KB |
実行使用メモリ | 43,360 KB |
最終ジャッジ日時 | 2024-12-25 21:17:22 |
合計ジャッジ時間 | 6,401 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
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(); } } }