結果
問題 | No.495 (^^*) Easy |
ユーザー | uafr_cs |
提出日時 | 2017-03-24 22:30:01 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 198 ms / 2,000 ms |
コード長 | 578 bytes |
コンパイル時間 | 2,301 ms |
コンパイル使用メモリ | 75,176 KB |
実行使用メモリ | 54,572 KB |
最終ジャッジ日時 | 2024-07-06 03:01:46 |
合計ジャッジ時間 | 3,695 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); final String str = sc.next(); int left_count = 0, right_count = 0; final Matcher left_match = Pattern.compile("(\\^\\^\\*)").matcher(str); final Matcher right_match = Pattern.compile("(\\*\\^\\^)").matcher(str); while(left_match.find()){ left_count++; } while(right_match.find()){ right_count++; } System.out.printf("%d %d\n", left_count, right_count); } }