結果
問題 | No.723 2つの数の和 |
ユーザー | バカらっく |
提出日時 | 2018-08-04 22:59:57 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,703 bytes |
コンパイル時間 | 1,032 ms |
コンパイル使用メモリ | 112,544 KB |
実行使用メモリ | 36,524 KB |
最終ジャッジ日時 | 2023-10-19 21:59:37 |
合計ジャッジ時間 | 3,548 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
25,644 KB |
testcase_01 | AC | 31 ms
25,644 KB |
testcase_02 | AC | 31 ms
25,644 KB |
testcase_03 | AC | 66 ms
32,904 KB |
testcase_04 | AC | 76 ms
33,864 KB |
testcase_05 | AC | 75 ms
33,532 KB |
testcase_06 | AC | 74 ms
33,692 KB |
testcase_07 | AC | 53 ms
28,156 KB |
testcase_08 | AC | 56 ms
28,344 KB |
testcase_09 | AC | 75 ms
33,968 KB |
testcase_10 | AC | 54 ms
28,096 KB |
testcase_11 | AC | 40 ms
26,568 KB |
testcase_12 | AC | 59 ms
29,548 KB |
testcase_13 | AC | 77 ms
34,096 KB |
testcase_14 | AC | 47 ms
27,324 KB |
testcase_15 | AC | 54 ms
28,212 KB |
testcase_16 | AC | 63 ms
29,980 KB |
testcase_17 | AC | 71 ms
33,388 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 32 ms
25,644 KB |
testcase_21 | AC | 31 ms
25,644 KB |
testcase_22 | AC | 31 ms
25,644 KB |
testcase_23 | AC | 78 ms
36,524 KB |
testcase_24 | AC | 49 ms
27,512 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.IO; using System.Linq; using System.Collections.Generic; using System.Text; public class Program { public void Proc() { int[] inpt = GetIntArray(); int total = inpt[1]; int[] items = GetIntArray(); Dictionary<int, int> dic = new Dictionary<int, int>(); foreach(int item in items) { if(dic.ContainsKey(item)) { dic[item]++; } else { dic[item] = 1; } } long ans = 0; foreach(int key in dic.Keys) { int pairKey = (int)(total - key); if(pairKey<0) { continue; } if(!dic.ContainsKey(pairKey)) { continue; } ans += dic[key] * dic[pairKey]; } Console.WriteLine(ans); } private int[] GetIntArray() { return Reader.ReadLine().Trim().Split(' ').Select(a => int.Parse(a)).ToArray(); } public class Reader { static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" 3 4 1 2 3 "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }