結果

問題 No.197 手品
ユーザー thorikawathorikawa
提出日時 2015-04-28 23:33:40
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,399 bytes
コンパイル時間 2,151 ms
コンパイル使用メモリ 76,260 KB
実行使用メモリ 58,632 KB
最終ジャッジ日時 2023-09-09 14:19:45
合計ジャッジ時間 11,186 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 156 ms
56,856 KB
testcase_01 AC 157 ms
56,768 KB
testcase_02 AC 158 ms
56,876 KB
testcase_03 AC 160 ms
57,028 KB
testcase_04 AC 157 ms
56,788 KB
testcase_05 AC 165 ms
56,824 KB
testcase_06 AC 157 ms
56,824 KB
testcase_07 AC 157 ms
56,444 KB
testcase_08 AC 159 ms
57,084 KB
testcase_09 AC 122 ms
55,836 KB
testcase_10 AC 157 ms
56,632 KB
testcase_11 AC 159 ms
56,456 KB
testcase_12 AC 158 ms
56,888 KB
testcase_13 AC 159 ms
56,720 KB
testcase_14 AC 161 ms
56,976 KB
testcase_15 AC 159 ms
56,624 KB
testcase_16 AC 161 ms
56,756 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 118 ms
55,768 KB
testcase_24 AC 157 ms
56,548 KB
testcase_25 AC 159 ms
56,720 KB
testcase_26 AC 158 ms
56,856 KB
testcase_27 AC 158 ms
56,616 KB
testcase_28 AC 159 ms
56,624 KB
testcase_29 AC 158 ms
56,760 KB
testcase_30 AC 159 ms
56,744 KB
testcase_31 AC 120 ms
56,076 KB
testcase_32 AC 119 ms
55,572 KB
testcase_33 AC 160 ms
56,720 KB
testcase_34 AC 160 ms
56,908 KB
testcase_35 AC 160 ms
56,840 KB
testcase_36 AC 160 ms
56,676 KB
testcase_37 WA -
testcase_38 AC 159 ms
56,660 KB
testcase_39 AC 160 ms
56,744 KB
testcase_40 AC 160 ms
57,028 KB
testcase_41 AC 160 ms
57,092 KB
testcase_42 AC 163 ms
57,052 KB
testcase_43 AC 161 ms
56,832 KB
testcase_44 WA -
testcase_45 AC 159 ms
56,824 KB
testcase_46 AC 161 ms
56,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

/**
 * Created by poly on 11/29/14.
 */
public class Main {
    static Set<String> cand(Set<String> set) {
        Set<String> list = new HashSet<String>();
        for (String s : set) {
            String a = "" + s.charAt(1) + s.charAt(0) + s.charAt(2);
            String b = "" + s.charAt(0) + s.charAt(2) + s.charAt(1);
            list.add(a);
            list.add(b);
        }
        return list;
    }

    public static void main(String[] argv) {
        Scanner scanner = new Scanner(System.in);
        String before = scanner.next();
        int n = scanner.nextInt();
        String after = scanner.next();
        if (n == 0) {
            if (after.equals(before)) {
                System.out.println("FAILURE");
            } else {
                System.out.println("SUCCESS");
            }
            return;
        }
        Set<String> input = new HashSet<String>();
        input.add(before);
        Set<String> one = cand(input);
        if (n % 2 == 1) {
            if (one.contains(after)) {
                System.out.println("FAILURE");
            } else {
                System.out.println("SUCCESS");
            }
            return;
        }
        Set<String> two = cand(one);
        if (two.contains(after)) {
            System.out.println("FAILURE");
        } else {
            System.out.println("SUCCESS");
        }
    }
}
0