結果

問題 No.683 Two Operations No.3
ユーザー bluemeganebluemegane
提出日時 2018-09-06 18:53:19
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 652 bytes
コンパイル時間 935 ms
コンパイル使用メモリ 69,260 KB
実行使用メモリ 27,088 KB
最終ジャッジ日時 2023-08-14 16:50:38
合計ジャッジ時間 4,668 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
27,088 KB
testcase_01 AC 55 ms
20,732 KB
testcase_02 AC 55 ms
20,760 KB
testcase_03 AC 56 ms
22,688 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = long.Parse(line[0]);
        var b = long.Parse(line[1]);
        Console.WriteLine(Func(a, b) ? "Yes" : "No");
    }
    public static bool Func(long a, long b)
    {
        if (b > a) Func(b, a);
        if (a == 0 | b == 0) return true;
        if (a % 2 == 1 && b % 2 == 1) return false;
        else if (a % 2 == 1 && b % 2 == 0) return Func(a - 1, b / 2);
        else if (a % 2 == 0 && b % 2 == 1) return Func(a / 2, b - 1);
        else return Func(a / 2, b - 1) | Func(a - 1, b / 2);
    }
}
0