結果

問題 No.723 2つの数の和
ユーザー TomoProgTomoProg
提出日時 2018-10-17 23:46:37
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 995 bytes
コンパイル時間 896 ms
コンパイル使用メモリ 107,264 KB
実行使用メモリ 34,176 KB
最終ジャッジ日時 2024-04-20 20:50:14
合計ジャッジ時間 4,622 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 32 ms
19,328 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    public class Program
    {
        static void Main(string[] args)
        {
            new Program().Main2(Console.In, Console.Out);
        }

        public void Main2(TextReader reader, TextWriter writer)
        {
            var sum = int.Parse(reader.ReadLine().Split()[1]);
            var progression = reader.ReadLine().Split().Select(x => int.Parse(x)).ToList();
            var combinationNum = 0;
            progression.Sort();
            foreach(var num in progression)
            {
                if (num > sum / 2) break;
                var another = Math.Abs(sum - num);
                var anotherList = progression.FindAll(n => n == another);
                combinationNum += anotherList.Count;
            }
            writer.WriteLine(combinationNum);
        }
    }
}
0