Hdu 1234 opens and closes the door

Source: Internet
Author: User

The question is good, 1234. The proposal is very simple. Now I will give you a few sets of data and ask you to find the people who open the door and close the door. Click the link below to open the link. It is actually the string processing of water and water, but the intensity of string is more than that. In a few days, the provincial competition will come back and write a new one. Because string will appear in any competition, stl and string functions are more popular with acmer.

[Cpp] <SPAN style = "FONT-SIZE: 18px" >#include <iostream>
# Include <string>
Using namespace std;
 
Int main ()
{
Int t;
Cin> t;
While (t --)
{
Int n;
Cin> n;
String id, start, end;
Cin> id> start> end;
String idstart, idend, startmin, endmax;
Idstart = id;
Idend = id;
Startmin = start;
Endmax = end;
 
For (int I = 1; I <n; I ++)
{
Cin> id> start> end;
If (start <startmin)
{
Startmin = start;
Idstart = id;
}
If (end> endmax)
{
Endmax = end;
Idend = id;
}
}
Cout <idstart <"<idend <endl;
}
Return 0;
} </SPAN>

# Include <iostream>
# Include <string>
Using namespace std;

Int main ()
{
Int t;
Cin> t;
While (t --)
{
Int n;
Cin> n;
String id, start, end;
Cin> id> start> end;
String idstart, idend, startmin, endmax;
Idstart = id;
Idend = id;
Startmin = start;
Endmax = end;

For (int I = 1; I <n; I ++)
{
Cin> id> start> end;
If (start <startmin)
{
Startmin = start;
Idstart = id;
}
If (end> endmax)
{
Endmax = end;
Idend = id;
}
}
Cout <idstart <"<idend <endl;
}
Return 0;
}
 

 

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.