結果
問題 | No.2035 Tunnel |
ユーザー | tenten |
提出日時 | 2023-12-07 10:23:14 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 142 ms / 2,000 ms |
コード長 | 1,730 bytes |
コンパイル時間 | 2,487 ms |
コンパイル使用メモリ | 87,072 KB |
実行使用メモリ | 58,120 KB |
最終ジャッジ日時 | 2023-12-07 10:23:22 |
合計ジャッジ時間 | 7,818 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 53 ms
53,984 KB |
testcase_01 | AC | 52 ms
53,996 KB |
testcase_02 | AC | 52 ms
53,968 KB |
testcase_03 | AC | 52 ms
53,992 KB |
testcase_04 | AC | 52 ms
53,988 KB |
testcase_05 | AC | 122 ms
57,660 KB |
testcase_06 | AC | 123 ms
57,900 KB |
testcase_07 | AC | 121 ms
57,864 KB |
testcase_08 | AC | 115 ms
57,808 KB |
testcase_09 | AC | 119 ms
57,660 KB |
testcase_10 | AC | 125 ms
58,120 KB |
testcase_11 | AC | 117 ms
55,908 KB |
testcase_12 | AC | 142 ms
57,656 KB |
testcase_13 | AC | 66 ms
54,372 KB |
testcase_14 | AC | 97 ms
55,524 KB |
testcase_15 | AC | 118 ms
55,660 KB |
testcase_16 | AC | 112 ms
55,792 KB |
testcase_17 | AC | 55 ms
53,988 KB |
testcase_18 | AC | 64 ms
54,120 KB |
testcase_19 | AC | 90 ms
55,652 KB |
testcase_20 | AC | 116 ms
56,732 KB |
testcase_21 | AC | 108 ms
55,860 KB |
testcase_22 | AC | 92 ms
55,524 KB |
testcase_23 | AC | 68 ms
54,496 KB |
testcase_24 | AC | 106 ms
55,776 KB |
testcase_25 | AC | 105 ms
55,776 KB |
testcase_26 | AC | 110 ms
55,784 KB |
testcase_27 | AC | 120 ms
57,804 KB |
testcase_28 | AC | 91 ms
55,672 KB |
testcase_29 | AC | 67 ms
54,620 KB |
testcase_30 | AC | 66 ms
54,504 KB |
ソースコード
import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); char[] inputs = sc.next().toCharArray(); int current = Integer.MIN_VALUE; for (int i = n - 1; i >= 0; i--) { if (inputs[i] == '#') { current = Math.max(current + 2, n - i); } } System.out.println(current); } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }