結果

問題 No.2773 Wake up Record 1
ユーザー tentententen
提出日時 2024-06-10 14:43:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 1,525 bytes
コンパイル時間 3,762 ms
コンパイル使用メモリ 90,736 KB
実行使用メモリ 54,772 KB
最終ジャッジ日時 2024-06-10 14:43:57
合計ジャッジ時間 7,175 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
51,072 KB
testcase_01 AC 77 ms
51,248 KB
testcase_02 AC 74 ms
50,844 KB
testcase_03 AC 73 ms
51,060 KB
testcase_04 AC 75 ms
51,100 KB
testcase_05 AC 164 ms
54,764 KB
testcase_06 AC 124 ms
52,532 KB
testcase_07 AC 163 ms
54,772 KB
testcase_08 AC 126 ms
52,252 KB
testcase_09 AC 123 ms
52,592 KB
testcase_10 AC 124 ms
52,372 KB
testcase_11 AC 154 ms
54,668 KB
testcase_12 AC 146 ms
54,704 KB
testcase_13 AC 88 ms
51,276 KB
testcase_14 AC 125 ms
52,412 KB
testcase_15 AC 80 ms
51,288 KB
testcase_16 AC 161 ms
54,620 KB
testcase_17 AC 139 ms
54,456 KB
testcase_18 AC 93 ms
51,324 KB
testcase_19 AC 159 ms
54,552 KB
testcase_20 AC 88 ms
51,584 KB
testcase_21 AC 156 ms
54,732 KB
testcase_22 AC 158 ms
54,580 KB
testcase_23 AC 159 ms
54,764 KB
testcase_24 AC 122 ms
52,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        char prev = 'x';
        int idx = 1;
        List<Integer> ans = new ArrayList<>();
        for (char c : sc.next().toCharArray()) {
            if (prev == 'x' && c == 'o') {
                ans.add(idx);
            }
            idx++;
            prev = c;
        }
        System.out.println(ans.size());
        System.out.println(ans.stream().map(x -> x.toString()).collect(Collectors.joining(" ")));
    }
}
class Scanner {
    BufferedReader br;
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
        } catch (Exception e) {
            
        }
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    
    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    
    public String next() {
        try {
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            return st.nextToken();
        }
    }
    
}


0