結果
問題 |
No.683 Two Operations No.3
|
ユーザー |
![]() |
提出日時 | 2020-05-08 16:37:14 |
言語 | Java (openjdk 23) |
結果 |
MLE
|
実行時間 | - |
コード長 | 944 bytes |
コンパイル時間 | 2,017 ms |
コンパイル使用メモリ | 74,980 KB |
実行使用メモリ | 832,052 KB |
最終ジャッジ日時 | 2024-07-03 09:53:21 |
合計ジャッジ時間 | 5,733 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 % 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; } } } }