結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
17,952 KB
testcase_01 AC 25 ms
17,564 KB
testcase_02 AC 25 ms
17,844 KB
testcase_03 AC 51 ms
23,328 KB
testcase_04 AC 56 ms
24,704 KB
testcase_05 AC 55 ms
24,320 KB
testcase_06 AC 56 ms
24,576 KB
testcase_07 AC 42 ms
21,276 KB
testcase_08 AC 43 ms
21,388 KB
testcase_09 AC 57 ms
25,088 KB
testcase_10 AC 41 ms
21,028 KB
testcase_11 AC 32 ms
19,328 KB
testcase_12 AC 45 ms
21,536 KB
testcase_13 AC 57 ms
24,704 KB
testcase_14 AC 37 ms
20,128 KB
testcase_15 AC 42 ms
21,496 KB
testcase_16 AC 47 ms
22,352 KB
testcase_17 AC 54 ms
23,936 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 25 ms
17,836 KB
testcase_21 AC 25 ms
17,972 KB
testcase_22 AC 25 ms
17,580 KB
testcase_23 AC 57 ms
25,216 KB
testcase_24 AC 38 ms
20,228 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(i<j && j<=100000){
                count += num[i] * num[j] * 2;
            }else if(i==j && j<=100000){
                count += num[i] * num[j];
            }
        }
        WriteLine(count);
    }
}
0