結果
| 問題 | No.4 おもりと天秤 |
| コンテスト | |
| ユーザー |
_matumo_
|
| 提出日時 | 2018-06-04 23:46:17 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 878 bytes |
| 記録 | |
| コンパイル時間 | 646 ms |
| コンパイル使用メモリ | 110,420 KB |
| 実行使用メモリ | 38,400 KB |
| 最終ジャッジ日時 | 2026-03-20 06:49:47 |
| 合計ジャッジ時間 | 62,147 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 TLE * 10 |
コンパイルメッセージ
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_