結果

問題 No.723 2つの数の和
ユーザー clocklrclocklr
提出日時 2018-09-28 16:54:41
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 715 bytes
コンパイル時間 1,036 ms
コンパイル使用メモリ 107,368 KB
実行使用メモリ 32,944 KB
最終ジャッジ日時 2024-04-20 09:29:04
合計ジャッジ時間 3,007 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
23,800 KB
testcase_01 AC 24 ms
21,748 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 55 ms
29,872 KB
testcase_05 AC 52 ms
29,576 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 42 ms
28,236 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 56 ms
30,180 KB
testcase_14 AC 36 ms
25,212 KB
testcase_15 AC 40 ms
26,416 KB
testcase_16 AC 48 ms
28,636 KB
testcase_17 AC 54 ms
31,784 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 25 ms
25,840 KB
testcase_21 AC 25 ms
26,104 KB
testcase_22 AC 25 ms
21,872 KB
testcase_23 AC 56 ms
30,140 KB
testcase_24 AC 38 ms
25,680 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using static System.Console;
using static System.Math;

public class Hello{
    public static void Main(){
        string[] input = ReadLine().Split(' ');
        int kazu = int.Parse(input[0]);
        int total = int.Parse(input[1]);
        string[] number = ReadLine().Split(' ');
        int[] num = new int[110000];
        int max = 0;
        for(int i=0;i<kazu;i++){
            int a = int.Parse(number[i]);
            num[a]++;
            max = Max(max,a);
        }
        
        int count = 0;
        for(int i=0;i<=max;i++){
            int j = total-i;
            if(j<=100000){
                count += num[i] * num[j];
            }
        }
        WriteLine(count);
    }
}
0