結果

問題 No.197 手品
ユーザー spaciaspacia
提出日時 2016-01-04 22:06:48
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,084 bytes
コンパイル時間 2,506 ms
コンパイル使用メモリ 73,496 KB
実行使用メモリ 49,764 KB
最終ジャッジ日時 2023-09-09 20:42:13
合計ジャッジ時間 6,159 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,272 KB
testcase_01 AC 42 ms
49,156 KB
testcase_02 AC 43 ms
49,200 KB
testcase_03 AC 43 ms
49,056 KB
testcase_04 AC 43 ms
49,216 KB
testcase_05 AC 42 ms
49,112 KB
testcase_06 AC 43 ms
49,372 KB
testcase_07 AC 42 ms
49,268 KB
testcase_08 AC 42 ms
49,096 KB
testcase_09 AC 42 ms
49,156 KB
testcase_10 AC 42 ms
47,460 KB
testcase_11 AC 43 ms
49,236 KB
testcase_12 AC 43 ms
49,164 KB
testcase_13 AC 43 ms
49,092 KB
testcase_14 AC 43 ms
49,304 KB
testcase_15 AC 43 ms
49,456 KB
testcase_16 AC 42 ms
49,296 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 42 ms
49,588 KB
testcase_21 AC 43 ms
49,212 KB
testcase_22 AC 43 ms
49,280 KB
testcase_23 AC 42 ms
49,268 KB
testcase_24 AC 43 ms
47,224 KB
testcase_25 AC 42 ms
49,156 KB
testcase_26 AC 42 ms
49,316 KB
testcase_27 AC 43 ms
49,268 KB
testcase_28 AC 43 ms
49,296 KB
testcase_29 AC 43 ms
48,996 KB
testcase_30 AC 43 ms
49,224 KB
testcase_31 AC 42 ms
49,332 KB
testcase_32 AC 43 ms
47,144 KB
testcase_33 AC 43 ms
49,240 KB
testcase_34 AC 43 ms
49,096 KB
testcase_35 AC 43 ms
49,212 KB
testcase_36 AC 43 ms
49,448 KB
testcase_37 WA -
testcase_38 AC 45 ms
49,204 KB
testcase_39 AC 43 ms
49,544 KB
testcase_40 AC 42 ms
49,312 KB
testcase_41 AC 43 ms
49,156 KB
testcase_42 AC 42 ms
49,408 KB
testcase_43 AC 42 ms
48,972 KB
testcase_44 WA -
testcase_45 AC 45 ms
49,428 KB
testcase_46 AC 43 ms
49,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.math.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static boolean solve (String s , String t , int n) {
		int cnt1 = 0 , cnt2 = 0;
		for (int i = 0; i < s.length(); i++) {
			if (s.charAt(i) == 'o') cnt1++;
			if (t.charAt(i) == 'o') cnt2++;
		}
		if (cnt1 != cnt2) return true;
		if (cnt1 == 0 || cnt1 == 3) return false;
		int p1 = -1 , p2 = -1;
		if (cnt1 == 1) {
			p1 = s.indexOf("o");
			p2 = t.indexOf("o");
		} else {
			p1 = s.indexOf("x");
			p2 = t.indexOf("x");
		}
		if (p1 == 1) {
			if (p2 == 1) {
				return n % 2 != 0;
			} else {
				return n == 0;
			}
		} else {
			if (p2 == 1) {
				return n == 0;
			} else {
				return p1 == p2 ? false : n < 2;
			}
		}
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String s = br.readLine();
		int n = Integer.parseInt(br.readLine());
		String t = br.readLine();
		
		out(solve(s , t , n) ? "SUCCESS" : "FAILURE");
		
	}
}
0