結果
問題 | No.197 手品 |
ユーザー |
|
提出日時 | 2016-03-22 14:21:02 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 135 ms / 1,000 ms |
コード長 | 975 bytes |
コンパイル時間 | 2,206 ms |
コンパイル使用メモリ | 77,092 KB |
実行使用メモリ | 41,820 KB |
最終ジャッジ日時 | 2024-07-20 03:48:12 |
合計ジャッジ時間 | 9,605 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
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("SUCCESS"); }else if(n==0){ if(str1.equals(str2)){ System.out.println("FAILURE"); }else{ System.out.println("SUCCESS"); } }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"); } } }