結果
問題 |
No.723 2つの数の和
|
ユーザー |
![]() |
提出日時 | 2018-08-23 23:48:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 488 bytes |
コンパイル時間 | 938 ms |
コンパイル使用メモリ | 69,884 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-29 18:20:48 |
合計ジャッジ時間 | 3,211 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 2 |
ソースコード
#include <iostream> #include <math.h> #include <string> #include <algorithm> typedef long long ll; #define MIN(x, y) (x < y ? x : y) #define MAX(x, y) (x > y ? x : y) using namespace std; int main(){ int N, X; cin >> N >> X; int a[100001] = {}; int cnt[100001] = {}; for(int i = 0; i < N; ++i){ cin >> a[i]; cnt[a[i]]++; } int ans = 0; for(int i = 0; i < N; ++i){ int diff = X - a[i]; if(diff >= 0 && diff <= 100000){ ans += cnt[diff]; } } cout << ans << endl; }