結果

問題 No.197 手品
ユーザー k_kadorak_kadora
提出日時 2015-06-15 02:50:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 1,000 ms
コード長 1,212 bytes
コンパイル時間 3,713 ms
コンパイル使用メモリ 74,728 KB
実行使用メモリ 56,036 KB
最終ジャッジ日時 2023-09-27 09:34:13
合計ジャッジ時間 11,049 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,580 KB
testcase_01 AC 126 ms
55,724 KB
testcase_02 AC 127 ms
55,492 KB
testcase_03 AC 126 ms
56,036 KB
testcase_04 AC 129 ms
55,648 KB
testcase_05 AC 127 ms
55,736 KB
testcase_06 AC 126 ms
55,760 KB
testcase_07 AC 125 ms
55,724 KB
testcase_08 AC 127 ms
55,888 KB
testcase_09 AC 126 ms
55,884 KB
testcase_10 AC 124 ms
55,936 KB
testcase_11 AC 125 ms
55,756 KB
testcase_12 AC 124 ms
55,836 KB
testcase_13 AC 127 ms
55,524 KB
testcase_14 AC 126 ms
55,848 KB
testcase_15 AC 125 ms
55,776 KB
testcase_16 AC 126 ms
55,824 KB
testcase_17 AC 127 ms
55,424 KB
testcase_18 AC 125 ms
53,736 KB
testcase_19 AC 125 ms
55,624 KB
testcase_20 AC 125 ms
55,512 KB
testcase_21 AC 126 ms
55,688 KB
testcase_22 AC 125 ms
55,404 KB
testcase_23 AC 125 ms
55,588 KB
testcase_24 AC 126 ms
55,768 KB
testcase_25 AC 125 ms
55,512 KB
testcase_26 AC 124 ms
55,644 KB
testcase_27 AC 125 ms
55,756 KB
testcase_28 AC 126 ms
53,756 KB
testcase_29 AC 124 ms
55,868 KB
testcase_30 AC 129 ms
55,816 KB
testcase_31 AC 125 ms
55,744 KB
testcase_32 AC 127 ms
55,836 KB
testcase_33 AC 125 ms
55,768 KB
testcase_34 AC 127 ms
55,872 KB
testcase_35 AC 128 ms
55,736 KB
testcase_36 AC 131 ms
55,456 KB
testcase_37 AC 126 ms
55,676 KB
testcase_38 AC 125 ms
55,676 KB
testcase_39 AC 124 ms
55,736 KB
testcase_40 AC 126 ms
55,696 KB
testcase_41 AC 127 ms
55,720 KB
testcase_42 AC 126 ms
55,424 KB
testcase_43 AC 125 ms
55,744 KB
testcase_44 AC 124 ms
55,772 KB
testcase_45 AC 125 ms
55,400 KB
testcase_46 AC 125 ms
55,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Yuki197{
	public static void main(String[] arg){
		Scanner sc = new Scanner(System.in);
		String be,af;
		int n,bo=0,ao=0,posb=0,posa=0;
		be = sc.next();
		n = sc.nextInt();
		af = sc.next();
		for(int i = 0;i<3;i++){
				if(be.charAt(i) == 'o')bo++;
				if(af.charAt(i) =='o')ao++;
			}
		if(n == 0){
			if(be.equals(af)){
				System.out.println("FAILURE");
			}else{
				System.out.println("SUCCESS");
			}
		}else if(n == 1){
			if(ao != bo){
				System.out.println("SUCCESS");
			}else{
				if(ao == 1){
					for(int i = 0;i<3;i++){
						if(be.charAt(i) == 'o')posb = i;
						if(af.charAt(i) == 'o')posa = i;
					}
					if(posb+posa != 2){
						System.out.println("FAILURE");
					}else{
						System.out.println("SUCCESS");
					}
				}else if(ao == 2){
					for(int i = 0;i<3;i++){
						if(be.charAt(i) != 'o')posb = i;
						if(af.charAt(i) != 'o')posa = i;
					}
					if(posb+posa != 2){
						System.out.println("FAILURE");
					}else{
						System.out.println("SUCCESS");
					}
				}else{
					System.out.println("FAILURE");
				}
			}
		}else{
			if(ao == bo){
				System.out.println("FAILURE");
			}else{
				System.out.println("SUCCESS");
			}
		}
	}
}
0