結果
問題 | No.197 手品 |
ユーザー |
![]() |
提出日時 | 2015-04-29 14:04:01 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 132 ms / 1,000 ms |
コード長 | 1,119 bytes |
コンパイル時間 | 1,937 ms |
コンパイル使用メモリ | 77,208 KB |
実行使用メモリ | 41,592 KB |
最終ジャッジ日時 | 2024-07-20 03:36:54 |
合計ジャッジ時間 | 8,630 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
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=a.deleteCharAt(0); a=a.insert(1, aa); StringBuilder b = new StringBuilder(mae); char bb = b.charAt(2); b=b.deleteCharAt(2); b=b.insert(1, bb); if(ato.equals(a.toString()) || ato.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"); } } } }