結果
問題 |
No.723 2つの数の和
|
ユーザー |
![]() |
提出日時 | 2018-08-04 12:21:53 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 469 bytes |
コンパイル時間 | 1,903 ms |
コンパイル使用メモリ | 74,248 KB |
実行使用メモリ | 59,612 KB |
最終ジャッジ日時 | 2024-09-19 17:47:49 |
合計ジャッジ時間 | 12,199 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 5 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int X = scan.nextInt(); int l = 100001; int []a = new int[l]; for(int i = 0; i < N; i++) { a[scan.nextInt()] ++; } scan.close(); long ans = 0; for(int i = 1; i < l; i++) { int res = X - i; if(res >= 1 && res <= 100000) { ans += a[i] * a[res]; } } System.out.println(ans); } }