結果
| 問題 |
No.723 2つの数の和
|
| コンテスト | |
| ユーザー |
clocklr
|
| 提出日時 | 2018-09-28 17:26:43 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 2,000 ms |
| コード長 | 722 bytes |
| コンパイル時間 | 830 ms |
| コンパイル使用メモリ | 112,740 KB |
| 実行使用メモリ | 32,644 KB |
| 最終ジャッジ日時 | 2024-10-12 05:24:58 |
| 合計ジャッジ時間 | 2,645 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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);
}
}
}
clocklr