結果

問題 No.4 おもりと天秤
ユーザー _matumo__matumo_
提出日時 2018-06-04 23:46:17
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 878 bytes
コンパイル時間 4,013 ms
コンパイル使用メモリ 103,684 KB
実行使用メモリ 23,708 KB
最終ジャッジ日時 2023-09-12 22:19:25
合計ジャッジ時間 12,632 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
23,536 KB
testcase_01 AC 59 ms
21,680 KB
testcase_02 AC 60 ms
21,540 KB
testcase_03 AC 60 ms
23,708 KB
testcase_04 AC 59 ms
21,608 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YukiCoder
{
    class Program
    {
        static int nMax;
        static Int32[] pv;
        static Int32 pvSum;
        static bool zzz(int ni, int vi)
        {
            if ((vi * 2) == pvSum) return true;
            if (ni >= nMax) return false;

            if (zzz(ni + 1, vi)) return true;
            return zzz(ni + 1, vi + pv[ni]);
        }

        
        static void Main(string[] args)
        {
            nMax = int.Parse(Console.ReadLine());
            pv = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //pv = new Int32[nMax + 1];
            pvSum = pv.Sum();
            if (zzz(0, 0))  Console.WriteLine("possible");
            else            Console.WriteLine("impossible");
            Console.ReadLine();
        }
    }
}
0