leetcode_remove_distance

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int a[5] = { 1,2,-1,3,5 };
    vector<int>num(a, a + 5);
    int tar;
    cin >> tar;
    cout << distance(num.begin(), remove(num.begin(), num.end(), tar));
    system("pause");
    return 0;
}

 

posted @ 2017-05-28 22:42  babyking1  阅读(92)  评论(0编辑  收藏  举报