結果
問題 |
No.723 2つの数の和
|
ユーザー |
![]() |
提出日時 | 2018-08-04 12:19:51 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 452 bytes |
コンパイル時間 | 2,223 ms |
コンパイル使用メモリ | 73,808 KB |
実行使用メモリ | 48,652 KB |
最終ジャッジ日時 | 2024-09-19 17:47:34 |
合計ジャッジ時間 | 12,435 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 4 RE * 10 |
ソースコード
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) { ans += a[i] * a[res]; } } System.out.println(ans); } }