結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
skewes
|
| 提出日時 | 2015-12-29 15:03:12 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 901 bytes |
| コンパイル時間 | 3,751 ms |
| コンパイル使用メモリ | 105,216 KB |
| 実行使用メモリ | 18,048 KB |
| 最終ジャッジ日時 | 2024-09-19 08:23:45 |
| 合計ジャッジ時間 | 2,221 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 RE * 1 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
namespace yukicoder
{
class _004
{
static void Main()
{
int n = int.Parse(Console.ReadLine());
int[] wn = Array.ConvertAll(Console.ReadLine().Split(' ')
, x => int.Parse(x));
bool[] s = new bool[n * 100];
s[0] = true;
int sum = 0;
foreach (int w in wn)
{
sum += w;
for (int i = n * 100 - 1; i >= 0; i--)
{
if(s[i])
{
s[i + w] = true;
}
}
}
if(sum % 2 == 0 && s[sum/2])
{
Console.WriteLine("possible");
}
else
{
Console.WriteLine("impossible");
}
Console.ReadLine();
}
}
}
skewes