結果

問題 No.638 Sum of "not power of 2"
ユーザー bluemeganebluemegane
提出日時 2018-09-09 13:07:39
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 680 bytes
コンパイル時間 2,044 ms
コンパイル使用メモリ 102,884 KB
実行使用メモリ 22,900 KB
最終ジャッジ日時 2023-08-24 20:24:20
合計ジャッジ時間 3,796 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

using System;

public class Hello
{
    public static void Main()
    {
        var s = new long[60];
        s[0] = 1;
        for (int i = 1; i < 60; i++)
            s[i] = s[i - 1] * 2L;
        var n = long.Parse(Console.ReadLine().Trim());
        var a = 1L;
        for (int i = 3; i <= n; i++)
            if (check(s, i) && check(s, n - i)) { Console.WriteLine("{0} {1}", i, n - i); goto end; }
        Console.WriteLine(-1);
        end:;
    }
    public static bool check(long[] s, long n)
    {
        for (int i = 0; i < 60; i++)
        {
            if (n == s[i]) return false;
            else if (n < s[i]) return true;
        }
        return true;
    }
}
0