結果
問題 | No.723 2つの数の和 |
ユーザー |
|
提出日時 | 2018-08-03 22:36:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 75 ms / 2,000 ms |
コード長 | 444 bytes |
コンパイル時間 | 637 ms |
コンパイル使用メモリ | 76,272 KB |
実行使用メモリ | 8,576 KB |
最終ジャッジ日時 | 2024-09-19 17:30:49 |
合計ジャッジ時間 | 2,316 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include<iostream> #include<map> using namespace std; typedef long long ll; int main(){ int n, x; cin >> n >> x; int a[n]; map<int, int> m; for(int i = 0; i < n; i++){ cin >> a[i]; m[a[i]]++; } ll cnt = 0; for(int i = 0; i < n; i++){ if(a[i] > x) continue; int target = x-a[i]; if(m.count(target)) cnt += m[target]; } cout << cnt << endl; return 0; }