結果

問題 No.197 手品
ユーザー spaciaspacia
提出日時 2016-01-04 21:58:17
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,088 bytes
コンパイル時間 1,955 ms
コンパイル使用メモリ 74,200 KB
実行使用メモリ 49,816 KB
最終ジャッジ日時 2023-09-09 20:42:19
合計ジャッジ時間 5,583 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,364 KB
testcase_01 AC 43 ms
49,816 KB
testcase_02 AC 42 ms
49,164 KB
testcase_03 AC 42 ms
49,164 KB
testcase_04 AC 43 ms
49,108 KB
testcase_05 AC 43 ms
49,020 KB
testcase_06 AC 42 ms
49,204 KB
testcase_07 AC 42 ms
49,168 KB
testcase_08 AC 42 ms
49,580 KB
testcase_09 AC 42 ms
49,156 KB
testcase_10 AC 43 ms
49,300 KB
testcase_11 AC 42 ms
49,160 KB
testcase_12 AC 42 ms
47,180 KB
testcase_13 AC 43 ms
49,016 KB
testcase_14 WA -
testcase_15 AC 42 ms
47,148 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 42 ms
49,468 KB
testcase_21 AC 43 ms
49,544 KB
testcase_22 AC 42 ms
49,212 KB
testcase_23 AC 42 ms
49,216 KB
testcase_24 AC 42 ms
49,164 KB
testcase_25 AC 42 ms
49,012 KB
testcase_26 AC 42 ms
49,336 KB
testcase_27 AC 42 ms
49,160 KB
testcase_28 AC 42 ms
49,572 KB
testcase_29 AC 42 ms
49,120 KB
testcase_30 AC 41 ms
49,304 KB
testcase_31 AC 41 ms
49,116 KB
testcase_32 AC 42 ms
49,312 KB
testcase_33 AC 42 ms
49,024 KB
testcase_34 AC 42 ms
49,172 KB
testcase_35 AC 43 ms
49,248 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 42 ms
49,100 KB
testcase_39 AC 43 ms
49,304 KB
testcase_40 AC 42 ms
49,484 KB
testcase_41 AC 43 ms
49,176 KB
testcase_42 AC 42 ms
49,340 KB
testcase_43 AC 42 ms
49,296 KB
testcase_44 WA -
testcase_45 AC 42 ms
49,100 KB
testcase_46 AC 42 ms
49,052 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 % 2 == 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