結果
問題 |
No.4 おもりと天秤
|
ユーザー |
|
提出日時 | 2017-06-08 13:08:42 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,142 bytes |
コンパイル時間 | 910 ms |
コンパイル使用メモリ | 110,792 KB |
実行使用メモリ | 29,364 KB |
最終ジャッジ日時 | 2024-09-22 13:27:40 |
合計ジャッジ時間 | 2,437 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 WA * 4 |
コンパイルメッセージ
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.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace YukiCoder_Cs { class Program { public static void Main() { int N = int.Parse(Console.ReadLine()); int[] list = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); string ans = "possible"; if (list.Sum()% 2 != 0) { ans = "impossible"; } else { int a = 0; int b = 0; Array.Sort(list); Array.Reverse(list); foreach (var item in list) { if (a > b) { b += item; } else { a += item; } } if (a != b) { ans = "impossible"; } } Console.WriteLine(ans); } } }