結果

問題 No.723 2つの数の和
ユーザー clocklrclocklr
提出日時 2018-09-28 17:13:34
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 718 bytes
コンパイル時間 4,920 ms
コンパイル使用メモリ 102,272 KB
実行使用メモリ 25,984 KB
最終ジャッジ日時 2024-04-20 09:57:54
合計ジャッジ時間 3,191 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
17,792 KB
testcase_01 AC 25 ms
17,664 KB
testcase_02 AC 25 ms
18,048 KB
testcase_03 AC 51 ms
23,320 KB
testcase_04 AC 58 ms
24,704 KB
testcase_05 AC 56 ms
24,124 KB
testcase_06 AC 56 ms
24,704 KB
testcase_07 AC 41 ms
21,792 KB
testcase_08 AC 44 ms
21,260 KB
testcase_09 AC 58 ms
25,216 KB
testcase_10 AC 41 ms
21,276 KB
testcase_11 AC 32 ms
18,732 KB
testcase_12 AC 46 ms
21,544 KB
testcase_13 AC 25 ms
17,664 KB
testcase_14 AC 25 ms
17,792 KB
testcase_15 AC 25 ms
17,792 KB
testcase_16 AC 24 ms
17,920 KB
testcase_17 AC 25 ms
18,048 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 25 ms
17,664 KB
testcase_21 AC 25 ms
17,792 KB
testcase_22 AC 25 ms
18,048 KB
testcase_23 AC 58 ms
24,960 KB
testcase_24 AC 39 ms
20,364 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(' ');
            int[] count = new int[300000];
            for(int i=0;i<n;i++){
                int temp = int.Parse(num[i]);
                count[temp]++;
            }
            int ans = 0;
            for(int i=0;i<=x;i++){
                int j = x-i;
                ans += count[i] * count[j];
            }
            WriteLine(ans);
        }
    }
}
0