結果

問題 No.197 手品
ユーザー kou6839
提出日時 2015-04-29 14:00:32
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 1,111 bytes
コンパイル時間 2,397 ms
コンパイル使用メモリ 77,380 KB
実行使用メモリ 55,892 KB
最終ジャッジ日時 2024-06-27 08:53:02
合計ジャッジ時間 9,961 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 38 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main {
	static int[] tatesum,yokosum;
	public static void main(String[] args){
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String mae  = sc.next();
		int n = sc.nextInt();
		String ato = sc.next();
		if(n==0){
			if(mae.equals(ato)){
				System.out.println("FAILURE");
			}else{
				System.out.println("SUCCESS");
			}
		}else if(n==1){
			StringBuilder a = new StringBuilder(mae);
			char aa = a.charAt(0);
			a.deleteCharAt(0);
			a.insert(0, aa);
			StringBuilder b = new StringBuilder(mae);
			char bb = b.charAt(0);
			b.deleteCharAt(0);
			b.insert(0, bb);
			if(mae.equals(a.toString()) || mae.equals(b.toString())){
				System.out.println("FAILURE");
			}else{
				System.out.println("SUCCESS");
			}
		}else{
			int countmae =0;
			for(int i=0;i<3;i++){
				if(mae.charAt(i)=='o') countmae++;
			}
			int countato=0;
			for(int i=0;i<3;i++){
				if(ato.charAt(i)=='o') countato++;
			}
			if(countato==countmae){
				System.out.println("FAILURE");
			}else{
				System.out.println("SUCCESS");
			}
		}
	}
}
0