結果

問題 No.723 2つの数の和
ユーザー clocklrclocklr
提出日時 2018-09-28 16:28:24
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 723 bytes
コンパイル時間 921 ms
コンパイル使用メモリ 108,620 KB
実行使用メモリ 32,180 KB
最終ジャッジ日時 2024-04-20 09:27:34
合計ジャッジ時間 2,772 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 21 ms
23,804 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 RE -
testcase_11 WA -
testcase_12 WA -
testcase_13 RE -
testcase_14 AC 32 ms
23,428 KB
testcase_15 AC 36 ms
26,160 KB
testcase_16 AC 42 ms
24,160 KB
testcase_17 AC 46 ms
31,440 KB
testcase_18 WA -
testcase_19 RE -
testcase_20 AC 22 ms
23,792 KB
testcase_21 AC 22 ms
21,748 KB
testcase_22 AC 21 ms
23,664 KB
testcase_23 RE -
testcase_24 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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[100000];
        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(i<=j && j<=100000){
                count += num[i] * num[j];
            }
        }
        WriteLine(count);
    }
}
0