結果

問題 No.638 Sum of "not power of 2"
ユーザー mencottonmencotton
提出日時 2018-01-26 22:28:26
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 594 bytes
コンパイル時間 2,239 ms
コンパイル使用メモリ 106,812 KB
実行使用メモリ 22,736 KB
最終ジャッジ日時 2023-08-28 18:09:26
合計ジャッジ時間 3,842 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
22,728 KB
testcase_01 AC 56 ms
18,736 KB
testcase_02 AC 56 ms
22,720 KB
testcase_03 AC 56 ms
20,720 KB
testcase_04 WA -
testcase_05 AC 56 ms
20,644 KB
testcase_06 AC 56 ms
22,736 KB
testcase_07 AC 56 ms
20,636 KB
testcase_08 AC 56 ms
20,860 KB
testcase_09 AC 57 ms
20,820 KB
testcase_10 AC 56 ms
20,784 KB
testcase_11 AC 56 ms
20,808 KB
testcase_12 AC 57 ms
20,776 KB
testcase_13 AC 55 ms
20,656 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace _638
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = new int[] { 3,5,6,7 };
            long n = long.Parse(Console.ReadLine());
            if (n < 8) Console.WriteLine(-1);
            else
            {
                int i = 0;
                for (; true; i++)
                {
                    long x = n - a[i];
                    while (x % 2 == 0) x /= 2;
                    if (x != 1) break;
                }
                Console.WriteLine(a[i] + " " + (n - a[i]));
            }
        }
    }
}
0