結果
問題 | No.683 Two Operations No.3 |
ユーザー |
![]() |
提出日時 | 2020-05-08 16:40:05 |
言語 | Java (openjdk 23) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,635 bytes |
コンパイル時間 | 1,935 ms |
コンパイル使用メモリ | 78,016 KB |
実行使用メモリ | 836,108 KB |
最終ジャッジ日時 | 2024-07-03 09:53:36 |
合計ジャッジ時間 | 6,062 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 MLE * 1 -- * 9 |
ソースコード
import java.util.*; public class Main { static int[] xArr; static int[] yArr; static int[] cArr; static int[][][] dp; static int fee; public static void main (String[] args) { Scanner sc = new Scanner(System.in); if (check(sc.nextLong(), sc.nextLong())) { System.out.println("Yes"); } else { System.out.println("No"); } } static boolean check(long a, long b) { if (a == 0 && b == 0) { return true; } if (a < 0 || b < 0) { return false; } if (a <= Integer.MAX_VALUE && b <= Integer.MAX_VALUE) { return check((int)a, (int)b); } if (a % 2 == 0) { if (b % 2 == 0) { if (check(a / 2, b - 1)) { return true; } else { return check(a - 1, b / 2); } } else { return check(a / 2, b - 1); } } else { if (b % 2 == 0) { return check(a - 1, b / 2); } else { return false; } } } static boolean check(int a, int b) { if (a == 0 && b == 0) { return true; } if (a < 0 || b < 0) { return false; } if (a % 2 == 0) { if (b % 2 == 0) { if (check(a / 2, b - 1)) { return true; } else { return check(a - 1, b / 2); } } else { return check(a / 2, b - 1); } } else { if (b % 2 == 0) { return check(a - 1, b / 2); } else { return false; } } } }