結果
問題 |
No.197 手品
|
ユーザー |
|
提出日時 | 2016-03-22 14:19:41 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 975 bytes |
コンパイル時間 | 2,107 ms |
コンパイル使用メモリ | 77,868 KB |
実行使用メモリ | 54,492 KB |
最終ジャッジ日時 | 2024-06-27 13:28:04 |
合計ジャッジ時間 | 9,714 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 36 WA * 7 |
ソースコード
package yukicoder197; import java.util.Scanner; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); String str1=sc.next(); int n=sc.nextInt(); String str2=sc.next(); int cntHasCoin1=0; int cntHasCoin2=0; for(int i=0;i<3;i++){ if(str1.charAt(i)=='o'){ cntHasCoin1++; } if(str2.charAt(i)=='o'){ cntHasCoin2++; } } if(cntHasCoin1!=cntHasCoin2){ System.out.println("FAILURE"); }else if(n==0){ if(str1.equals(str2)){ System.out.println("SUCCESS"); }else{ System.out.println("FAILURE"); } }else if(n==1){ if(str1.charAt(0)==str2.charAt(1)&&str1.charAt(1)==str2.charAt(0)){ System.out.println("FAILURE"); }else if(str1.charAt(1)==str2.charAt(2)&&str1.charAt(2)==str2.charAt(1)){ System.out.println("FAILURE"); }else{ System.out.println("SUCCESS"); } }else if(n>=2){ System.out.println("FAILURE"); }else{ System.err.println("ERROR"); } } }