結果
問題 | No.495 (^^*) Easy |
ユーザー | jimano |
提出日時 | 2018-01-27 16:42:44 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 119 ms / 2,000 ms |
コード長 | 734 bytes |
コンパイル時間 | 2,974 ms |
コンパイル使用メモリ | 76,148 KB |
実行使用メモリ | 55,544 KB |
最終ジャッジ日時 | 2023-08-28 09:55:04 |
合計ジャッジ時間 | 4,164 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 71 ms
50,536 KB |
testcase_01 | AC | 73 ms
53,220 KB |
testcase_02 | AC | 74 ms
52,412 KB |
testcase_03 | AC | 69 ms
50,700 KB |
testcase_04 | AC | 72 ms
50,520 KB |
testcase_05 | AC | 97 ms
53,568 KB |
testcase_06 | AC | 119 ms
55,544 KB |
ソースコード
package me.yukicoder.wip; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No0495_2 { public static void main(String[] args) { try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) { String input = br.readLine(); int length = input.length(); int cntLeft = 0; int cntRight = 0; String right = "(*^^)"; String left = "(^^*)"; for (int i = 0; i < length - 5; i++) { if (input.substring(i, i + 5).equals(right)) { cntRight++; } else if (input.substring(i, i + 5).equals(left)) { cntLeft++; } } System.out.println(cntLeft + " " + cntRight); } catch (IOException e) { e.printStackTrace(); } } }