結果

問題 No.723 2つの数の和
ユーザー clocklrclocklr
提出日時 2018-09-28 16:56:56
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 728 bytes
コンパイル時間 834 ms
コンパイル使用メモリ 102,784 KB
実行使用メモリ 26,496 KB
最終ジャッジ日時 2024-04-20 09:29:07
合計ジャッジ時間 2,759 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
17,840 KB
testcase_01 AC 24 ms
17,700 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 56 ms
24,704 KB
testcase_05 AC 54 ms
23,936 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 41 ms
21,292 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 58 ms
25,088 KB
testcase_14 AC 36 ms
20,396 KB
testcase_15 AC 41 ms
21,128 KB
testcase_16 AC 47 ms
22,348 KB
testcase_17 AC 52 ms
24,212 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 25 ms
17,716 KB
testcase_21 AC 24 ms
17,968 KB
testcase_22 AC 25 ms
17,700 KB
testcase_23 AC 56 ms
25,088 KB
testcase_24 AC 38 ms
20,116 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 && i<=100000){
                count += num[i] * num[j];
            }
        }
        WriteLine(count);
    }
}
0