Http://acm.nyist.net/JudgeOnline/problemrank.php? PID = 1, 525

Source: Internet
Author: User

It can be used as an entry-level question for STL. I forgot to consider that the last character string should not end with 5, so there is always one less data ..

# Include <string> # include <set> # include <iostream> # include <cstdio> # include <stdlib. h> using namespace STD; int main () {string s; while (CIN> S) {Multiset <int> q; string S1 = ""; for (INT I = 0; I <S. size (); ++ I) {If (s [I] = '5') {If (s1.size () = 0) continue; int A = atoi (s1.data (); q. insert (a); S1 = "";} else S1 + = s [I];} If (s1.size ()> 0) // This point is missing {int A = atoi (s1.data (); q. insert (a);} If (Q. empty () {printf ("0 \ n"); c Ontinue;} Multiset <int>: iterator ITER; For (iter = Q. Begin (); iter! = Q. End (); ++ ITER) printf ("% d", * ITER); printf ("\ n");} return 0 ;}

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.