結果
問題 |
No.4 おもりと天秤
|
ユーザー |
|
提出日時 | 2017-05-10 17:22:59 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 796 bytes |
コンパイル時間 | 858 ms |
コンパイル使用メモリ | 104,320 KB |
実行使用メモリ | 18,048 KB |
最終ジャッジ日時 | 2024-09-15 07:10:41 |
合計ジャッジ時間 | 2,496 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 13 |
コンパイルメッセージ
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; class Progaram { static void Main() { int total = 0; int kazu = int.Parse(Console.ReadLine()); string[] values = Console.ReadLine().Split(' '); List<int> list = new List<int>(); for(int i = 0;i<values.Length;i++){ list.Add(int.Parse(values[i])); total += int.Parse(values[i]); } list.Sort(); int x = 0; int y = 0; foreach(int i in list){ if(total / 2 >= x){ x += i; } else{ y += i; } } if(x == y){ Console.WriteLine("possible"); } else{ Console.WriteLine("impossible"); } } }