3273

    [실3] 3273 - 두 수의 합

    #include #include #include using namespace std; int main() { int n; cin >> n; vector v(n); for (int i = 0; i > v[i]; sort(v.begin(), v.end()); int x; cin >> x; int s = 0, e = n - 1, cnt = 0; while (s < e) { int a = v[s], b = v[e]; int sum = a + b; if (sum == x) cnt++; if (sum < x) s++; else e--; } cout