結果
問題 |
No.723 2つの数の和
|
ユーザー |
|
提出日時 | 2018-10-17 23:43:31 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 992 bytes |
コンパイル時間 | 919 ms |
コンパイル使用メモリ | 106,112 KB |
実行使用メモリ | 34,048 KB |
最終ジャッジ日時 | 2024-10-12 18:57:11 |
合計ジャッジ時間 | 4,592 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | TLE * 1 -- * 21 |
コンパイルメッセージ
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; 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) break; var another = Math.Abs(sum - num); var anotherList = progression.FindAll(n => n == another); combinationNum += anotherList.Count; } writer.WriteLine(combinationNum); } } }