結果

問題 No.197 手品
ユーザー keitaro9mlkeitaro9ml
提出日時 2015-05-02 11:26:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 115 ms / 1,000 ms
コード長 1,243 bytes
コンパイル時間 4,115 ms
コンパイル使用メモリ 74,400 KB
実行使用メモリ 56,300 KB
最終ジャッジ日時 2023-09-27 09:30:43
合計ジャッジ時間 8,707 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
56,276 KB
testcase_01 AC 113 ms
55,840 KB
testcase_02 AC 109 ms
55,804 KB
testcase_03 AC 109 ms
55,572 KB
testcase_04 AC 114 ms
56,180 KB
testcase_05 AC 111 ms
56,144 KB
testcase_06 AC 110 ms
56,040 KB
testcase_07 AC 115 ms
55,956 KB
testcase_08 AC 113 ms
56,164 KB
testcase_09 AC 109 ms
56,148 KB
testcase_10 AC 109 ms
55,988 KB
testcase_11 AC 109 ms
55,808 KB
testcase_12 AC 107 ms
55,904 KB
testcase_13 AC 114 ms
55,948 KB
testcase_14 AC 115 ms
55,948 KB
testcase_15 AC 109 ms
56,020 KB
testcase_16 AC 110 ms
55,760 KB
testcase_17 AC 107 ms
56,164 KB
testcase_18 AC 106 ms
55,872 KB
testcase_19 AC 112 ms
55,836 KB
testcase_20 AC 114 ms
55,992 KB
testcase_21 AC 113 ms
56,008 KB
testcase_22 AC 109 ms
56,300 KB
testcase_23 AC 109 ms
55,996 KB
testcase_24 AC 108 ms
56,184 KB
testcase_25 AC 109 ms
56,200 KB
testcase_26 AC 111 ms
55,820 KB
testcase_27 AC 111 ms
56,296 KB
testcase_28 AC 111 ms
56,100 KB
testcase_29 AC 112 ms
56,096 KB
testcase_30 AC 113 ms
56,004 KB
testcase_31 AC 113 ms
55,852 KB
testcase_32 AC 108 ms
56,144 KB
testcase_33 AC 112 ms
56,076 KB
testcase_34 AC 111 ms
56,176 KB
testcase_35 AC 112 ms
55,688 KB
testcase_36 AC 111 ms
55,772 KB
testcase_37 AC 115 ms
56,256 KB
testcase_38 AC 111 ms
55,992 KB
testcase_39 AC 110 ms
55,748 KB
testcase_40 AC 109 ms
56,112 KB
testcase_41 AC 112 ms
56,216 KB
testcase_42 AC 109 ms
55,696 KB
testcase_43 AC 110 ms
55,840 KB
testcase_44 AC 111 ms
55,880 KB
testcase_45 AC 111 ms
55,820 KB
testcase_46 AC 110 ms
55,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;
 
public class Main {
	
	static char[] Sb;
	static char[] Sa;
	static int N;
	
	private static void solve() {
		int sbo = 0;
		int sao = 0;
		
		for(int i = 0; i<3; i++){
			if(Sb[i] == 'o'){
				sbo++;
			}
			if(Sa[i] == 'o'){
				sao++;
			}
		}
		
		if(sbo != sao){
			System.out.println("SUCCESS");
			return;
		}
		
		if(N>=2){
			System.out.println("FAILURE");
			return;
		}
		
		ArrayList<char[]> list = new ArrayList<char[]>();
		if(N == 0){
			list.add(Sb);
		}
		
		if(N == 1){
			list.add(new char[]{Sb[1], Sb[0], Sb[2]});
			list.add(new char[]{Sb[0], Sb[2], Sb[1]});
		}
		
		Iterator<char[]> ite = list.iterator();
		while(ite.hasNext()){
			char[] c = ite.next();
			if(c[0] == Sa[0] && c[1] == Sa[1] && c[2] == Sa[2]){
				System.out.println("FAILURE");
				return;
			}
		}
		
		System.out.println("SUCCESS");
		return;		
	}
	
	public static void main(String[] args) {
		read();
		
		solve();
	}
	
	public static void read(){
		Scanner scan = new Scanner(new InputStreamReader(System.in));
		
		Sb = scan.next().toCharArray();
		N = scan.nextInt();
		Sa = scan.next().toCharArray();
		
		scan.close();
	}
	
}
0