Blue Bridge Cup ALGO-111 random number (sort, go weight)

Source: Internet
Author: User

"Idea": vector perfect solution. Notice the dynamic array of vectors, or else 0.

"AC Code":

#include <iostream> #include <algorithm> #include <vector> #include <cstdio> #include < cstring>using namespace std; #define MAX 100+5int cmp (int a, int b) {return a < b;}  int main () {//freopen ("In.txt", "R", stdin), int n = 0, i = 0;//inputcin >> n;vector<int> A (n);vector<int> :: Iterator iter;for (i = 0; i < n; i++) cin >> A[i];//sortsort (A.begin (), A.end (), CMP);//deletefor (Iter = a.be Gin (+1); Iter! = A.end (); {int c = (*iter), d = (* (Iter-1)), if ((*iter) = = (* (Iter-1))) Iter = A.erase (iter); elseiter++;} Outputcout << a.size () << endl;for (Iter = A.begin (); Iter! = A.end (); iter++) cout << (*iter) << ""; return 0;}


Blue Bridge Cup ALGO-111 random number (sort, go weight)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.