結果

問題 No.197 手品
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-12-09 18:33:10
言語 Java19
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,339 bytes
コンパイル時間 2,137 ms
コンパイル使用メモリ 73,896 KB
実行使用メモリ 56,352 KB
最終ジャッジ日時 2023-09-09 21:07:40
合計ジャッジ時間 9,802 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,808 KB
testcase_01 AC 126 ms
55,484 KB
testcase_02 AC 127 ms
55,732 KB
testcase_03 AC 126 ms
55,908 KB
testcase_04 AC 126 ms
55,680 KB
testcase_05 AC 125 ms
55,732 KB
testcase_06 AC 126 ms
56,132 KB
testcase_07 AC 126 ms
55,512 KB
testcase_08 AC 126 ms
55,724 KB
testcase_09 AC 125 ms
55,892 KB
testcase_10 AC 129 ms
56,136 KB
testcase_11 AC 126 ms
55,772 KB
testcase_12 AC 126 ms
55,880 KB
testcase_13 AC 126 ms
55,996 KB
testcase_14 AC 125 ms
55,484 KB
testcase_15 AC 126 ms
55,796 KB
testcase_16 AC 125 ms
55,644 KB
testcase_17 AC 126 ms
55,764 KB
testcase_18 AC 126 ms
55,792 KB
testcase_19 AC 128 ms
56,088 KB
testcase_20 AC 125 ms
55,692 KB
testcase_21 AC 124 ms
56,064 KB
testcase_22 AC 125 ms
55,784 KB
testcase_23 AC 126 ms
53,656 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 127 ms
55,924 KB
testcase_27 AC 125 ms
55,912 KB
testcase_28 AC 125 ms
55,928 KB
testcase_29 AC 126 ms
55,828 KB
testcase_30 AC 126 ms
55,728 KB
testcase_31 AC 123 ms
55,696 KB
testcase_32 AC 124 ms
56,000 KB
testcase_33 WA -
testcase_34 AC 124 ms
55,908 KB
testcase_35 AC 125 ms
56,000 KB
testcase_36 AC 125 ms
55,692 KB
testcase_37 AC 127 ms
55,820 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 127 ms
55,684 KB
testcase_41 AC 125 ms
55,464 KB
testcase_42 AC 131 ms
55,488 KB
testcase_43 AC 126 ms
55,872 KB
testcase_44 AC 127 ms
55,892 KB
testcase_45 AC 126 ms
55,528 KB
testcase_46 AC 126 ms
55,852 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String Sbefore = sc.next();
        int N = sc.nextInt();
        String Safter = sc.next();
        String ans = judge(Sbefore, Safter, N);
        System.out.println(ans);
        
    }
    static String judge(String x, String y, int N){
        String ans = "SUCCESS";
        int a=0;
        int b=0;
        for(int i=0; i<3; i++){
            if(x.charAt(i)=='o')a++;
        }
        for(int i=0; i<3; i++){
            if(y.charAt(i)=='o')b++;
        }
        if(a==b){
            if(N>=2){
                ans="FAILURE";
            }else if(N==0){
                if(x.equals(y)){
                    ans="FAILURE";
                }
            }else{
                char [] c = x.toCharArray();
                char [] p = new char [3];
                for(int i=0; i<2; i++){
                    if(i==1)continue;
                    p[i]=c[i];
                    p[(i+1)%3]=c[(i+2)%3];
                    p[(i+2)%3]=c[(i+1)%3];
                    String t = String.valueOf(p);
                    if(t.equals(y)){
                        ans="FAILURE";
                        break;
                    }
                }
            }
        }
        return ans;
    }
}
0