結果

問題 No.197 手品
ユーザー k_kadorak_kadora
提出日時 2015-06-14 22:51:26
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,664 bytes
コンパイル時間 3,658 ms
コンパイル使用メモリ 75,132 KB
実行使用メモリ 58,064 KB
最終ジャッジ日時 2023-09-09 17:10:33
合計ジャッジ時間 11,457 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,440 KB
testcase_01 AC 120 ms
56,036 KB
testcase_02 AC 121 ms
55,928 KB
testcase_03 AC 121 ms
55,532 KB
testcase_04 AC 121 ms
55,760 KB
testcase_05 AC 121 ms
55,964 KB
testcase_06 AC 120 ms
54,272 KB
testcase_07 AC 123 ms
55,632 KB
testcase_08 AC 120 ms
55,928 KB
testcase_09 AC 120 ms
55,872 KB
testcase_10 AC 122 ms
55,592 KB
testcase_11 AC 121 ms
55,940 KB
testcase_12 WA -
testcase_13 AC 126 ms
55,612 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 120 ms
55,656 KB
testcase_24 AC 121 ms
55,896 KB
testcase_25 AC 121 ms
55,772 KB
testcase_26 AC 120 ms
55,872 KB
testcase_27 WA -
testcase_28 AC 121 ms
56,588 KB
testcase_29 WA -
testcase_30 AC 121 ms
56,232 KB
testcase_31 AC 122 ms
55,996 KB
testcase_32 AC 121 ms
55,804 KB
testcase_33 WA -
testcase_34 AC 121 ms
55,740 KB
testcase_35 AC 122 ms
55,540 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 122 ms
56,116 KB
testcase_39 WA -
testcase_40 AC 121 ms
55,724 KB
testcase_41 WA -
testcase_42 AC 123 ms
55,884 KB
testcase_43 AC 123 ms
55,928 KB
testcase_44 WA -
testcase_45 AC 122 ms
55,612 KB
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Yuki197{
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		String b,a;
		int n,ob=0,xb=0,oa=0,xa=0;
		b = sc.next();
		n = sc.nextInt();
		a = sc.next();
		for(int i =0;i<3;i++){
			if(b.charAt(i) == 'o'){
				ob++;
			}else{
				xb++;
			}
			if(a.charAt(i) == 'o'){
				oa++;
			}else{
				xa++;
			}
		}
		if(ob != oa){
			System.out.println("SUCCESS");
		}else{
			int posb = 0,posa=0;
			if(n % 2 == 0){
				if(ob == 1){
					for(int i = 0;i<3;i++){
						if(b.charAt(i) == 'o')posb = i;
						if(a.charAt(i) == 'o')posa = i;
					}
					if(Math.abs(posa-posb) % 2 == 0){
						System.out.println("FAILURE");
					}else{
						System.out.println("SUCCESS");
					}
				}else if(ob == 2){
					for(int i = 0;i<3;i++){
						if(b.charAt(i) == 'x')posb = i;
						if(a.charAt(i) == 'x')posa = i;
					}
					if(Math.abs(posa-posb) % 2 == 0){
						System.out.println("FAILURE");
					}else{
						System.out.println("SUCCESS");
					}
				}else{
					System.out.println("FAILURE");
				}
			}else{
				if(ob == 1){
					for(int i = 0;i<3;i++){
						if(b.charAt(i) == 'o')posb = i;
						if(a.charAt(i) == 'o')posa = i;
					}
					if(Math.abs(posa-posb )% 2 == 0){
						System.out.println("SUCCESS");
					}else{
						System.out.println("FAILURE");
					}
				}else if(ob == 2){
					for(int i = 0;i<3;i++){
						if(b.charAt(i) == 'x')posb = i;
						if(a.charAt(i) == 'x')posa = i;
					}
					if(Math.abs(posa-posb) % 2 == 0){
						System.out.println("SUCCESS");
					}else{
						System.out.println("FAILURE");
					}
				}else{
					System.out.println("FAILURE");
				}
			}
		}
	}
}
0