結果

問題 No.197 手品
ユーザー crazybbb3crazybbb3
提出日時 2017-01-17 22:24:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 61 ms / 1,000 ms
コード長 2,320 bytes
コンパイル時間 3,721 ms
コンパイル使用メモリ 78,416 KB
実行使用メモリ 51,436 KB
最終ジャッジ日時 2023-09-27 09:43:50
合計ジャッジ時間 8,140 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
50,800 KB
testcase_01 AC 59 ms
50,704 KB
testcase_02 AC 59 ms
50,620 KB
testcase_03 AC 60 ms
49,036 KB
testcase_04 AC 59 ms
50,712 KB
testcase_05 AC 59 ms
50,620 KB
testcase_06 AC 59 ms
50,624 KB
testcase_07 AC 59 ms
50,956 KB
testcase_08 AC 59 ms
50,800 KB
testcase_09 AC 59 ms
51,232 KB
testcase_10 AC 61 ms
51,104 KB
testcase_11 AC 59 ms
50,604 KB
testcase_12 AC 60 ms
51,040 KB
testcase_13 AC 60 ms
51,072 KB
testcase_14 AC 59 ms
50,552 KB
testcase_15 AC 57 ms
50,988 KB
testcase_16 AC 58 ms
50,680 KB
testcase_17 AC 59 ms
49,108 KB
testcase_18 AC 59 ms
50,872 KB
testcase_19 AC 58 ms
50,868 KB
testcase_20 AC 58 ms
50,972 KB
testcase_21 AC 59 ms
50,620 KB
testcase_22 AC 60 ms
50,704 KB
testcase_23 AC 60 ms
49,232 KB
testcase_24 AC 60 ms
50,760 KB
testcase_25 AC 59 ms
50,964 KB
testcase_26 AC 59 ms
50,532 KB
testcase_27 AC 59 ms
50,676 KB
testcase_28 AC 60 ms
50,836 KB
testcase_29 AC 60 ms
51,120 KB
testcase_30 AC 59 ms
50,620 KB
testcase_31 AC 59 ms
50,860 KB
testcase_32 AC 59 ms
50,912 KB
testcase_33 AC 59 ms
51,236 KB
testcase_34 AC 60 ms
51,436 KB
testcase_35 AC 60 ms
50,828 KB
testcase_36 AC 59 ms
50,616 KB
testcase_37 AC 59 ms
51,076 KB
testcase_38 AC 59 ms
50,720 KB
testcase_39 AC 58 ms
50,696 KB
testcase_40 AC 59 ms
50,624 KB
testcase_41 AC 58 ms
50,856 KB
testcase_42 AC 59 ms
51,140 KB
testcase_43 AC 59 ms
51,116 KB
testcase_44 AC 58 ms
50,884 KB
testcase_45 AC 59 ms
50,832 KB
testcase_46 AC 60 ms
51,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import java.util.stream.Stream;

public class CreateInput {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        String s1 = ns();
        int n = ni();
        String s2 = ns();

        if (s1.chars().map(c -> c == 'o' ? 1 : 0).sum() != s2.chars().map(c -> c == 'o' ? 1 : 0).sum()) {
            out.println("SUCCESS");
        } else if (n == 0 && !s2.equals(s1)) {
            out.println("SUCCESS");
        } else if (s1.equals("ooo") && s2.equals("ooo") || s1.equals("xxx") && s2.equals("xxx")) {
            out.println("FAILURE");
        } else if (n == 1 && new StringBuilder(s2).reverse().toString().equals(s1)) {
            out.println("SUCCESS");
        } else {
            out.println("FAILURE");
        }
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        CreateInput main = new CreateInput();
        main.solve();
        out.close();
    }
}
0