結果

問題 No.297 カードの数式
ユーザー r_nokor_noko
提出日時 2015-11-08 19:09:00
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,476 bytes
コンパイル時間 3,889 ms
コンパイル使用メモリ 109,100 KB
実行使用メモリ 28,984 KB
最終ジャッジ日時 2023-10-11 15:21:00
合計ジャッジ時間 6,211 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
26,840 KB
testcase_01 AC 105 ms
24,912 KB
testcase_02 AC 107 ms
24,760 KB
testcase_03 AC 108 ms
26,848 KB
testcase_04 AC 106 ms
22,952 KB
testcase_05 AC 105 ms
22,880 KB
testcase_06 WA -
testcase_07 AC 105 ms
24,728 KB
testcase_08 AC 106 ms
26,760 KB
testcase_09 AC 104 ms
25,040 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 107 ms
25,032 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 108 ms
24,844 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

namespace contest
{
    class Program
    {
        static void Main(string[] args)
        {
            var dm = Console.ReadLine();

            string[] input = Console.ReadLine().Split(' ');
            var p = input.Where(x => x == "+").Select(x => x);
            var m = input.Where(x => x == "-").Select(x => x);
            var pm = p.Concat(m);
            var n = input.Where(x => !pm.Contains(x)).OrderByDescending(x => x).Select(x => x);
            var nn = input.Where(x => !pm.Contains(x)).OrderBy(x => x).Select(x => x);

            var g = n.Take(n.Count() - pm.Count()).Select(x => x);
            double b = 0;
            string ss = "";
            double a = 0;

            for (int i = 0; i < g.Count(); i++)
                ss += g.ToArray()[i];
            b = a = double.Parse(ss);

            int cnt = g.Count();
            int ncnt = cnt;

            for (int i = 0; i < p.Count(); i++)
            {
                a += double.Parse(n.Skip(cnt++).Select(x => x).ToArray()[0]);
                b += double.Parse(n.Skip(ncnt++).Select(x => x).ToArray()[0]);

            }

            for (int i = 0; i < m.Count(); i++)
            {
                a -= double.Parse(n.Skip(cnt++).Select(x => x).ToArray()[0]);
                b = double.Parse(n.Skip(ncnt++).Select(x => x).ToArray()[0]) - b;
            }


            Console.WriteLine(a + " " + b);
            Console.ReadLine();
        }
    }
}
0