結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
_matumo_
|
| 提出日時 | 2018-06-04 23:46:17 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 878 bytes |
| コンパイル時間 | 784 ms |
| コンパイル使用メモリ | 108,252 KB |
| 実行使用メモリ | 30,676 KB |
| 最終ジャッジ日時 | 2024-06-30 09:49:42 |
| 合計ジャッジ時間 | 7,565 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 TLE * 1 -- * 17 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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();
}
}
}
_matumo_