結果
問題 | No.683 Two Operations No.3 |
ユーザー |
![]() |
提出日時 | 2018-09-06 18:52:01 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 643 bytes |
コンパイル時間 | 2,468 ms |
コンパイル使用メモリ | 102,912 KB |
実行使用メモリ | 828,900 KB |
最終ジャッジ日時 | 2024-11-22 15:47:32 |
合計ジャッジ時間 | 13,548 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 TLE * 1 MLE * 4 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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 (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);}}