結果

問題 No.723 2つの数の和
ユーザー clocklrclocklr
提出日時 2018-09-28 17:26:43
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 722 bytes
コンパイル時間 1,831 ms
コンパイル使用メモリ 110,024 KB
実行使用メモリ 32,548 KB
最終ジャッジ日時 2024-04-20 09:58:41
合計ジャッジ時間 2,870 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
26,012 KB
testcase_01 AC 25 ms
24,036 KB
testcase_02 AC 26 ms
21,940 KB
testcase_03 AC 52 ms
29,792 KB
testcase_04 AC 60 ms
32,548 KB
testcase_05 AC 56 ms
30,248 KB
testcase_06 AC 58 ms
30,392 KB
testcase_07 AC 44 ms
26,236 KB
testcase_08 AC 45 ms
27,980 KB
testcase_09 AC 59 ms
32,272 KB
testcase_10 AC 43 ms
26,180 KB
testcase_11 AC 34 ms
24,928 KB
testcase_12 AC 47 ms
26,464 KB
testcase_13 AC 25 ms
25,812 KB
testcase_14 AC 25 ms
21,820 KB
testcase_15 AC 26 ms
25,876 KB
testcase_16 AC 25 ms
23,804 KB
testcase_17 AC 25 ms
23,852 KB
testcase_18 AC 49 ms
26,072 KB
testcase_19 AC 58 ms
32,324 KB
testcase_20 AC 24 ms
23,812 KB
testcase_21 AC 26 ms
25,756 KB
testcase_22 AC 25 ms
26,124 KB
testcase_23 AC 58 ms
30,760 KB
testcase_24 AC 40 ms
27,612 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 n = int.Parse(input[0]);
        int x = int.Parse(input[1]);
        if(x>200000){
            WriteLine("0");
        }else{
            string[] num = ReadLine().Split(' ');
            long[] count = new long[300000];
            for(int i=0;i<n;i++){
                int temp = int.Parse(num[i]);
                count[temp]++;
            }
            long ans = 0;
            for(int i=0;i<=x;i++){
                int j = x-i;
                ans += count[i] * count[j];
            }
            WriteLine(ans);
        }
    }
}
0