1407291508-hd-this summer vacation is not ac. cpp

Source: Internet
Author: User

/* Train of Thought:
The first response to this question is to sort the start time.
However, this will be troublesome.
I should change the angle and thinking of questions.
Sort this question by End Time
It will be much simpler */
# Include <stdio. h>
# Include <stdlib. h> // header files are required for qsort sorting.
Struct move
{
Int tis;
Int tie; // Member
} Num [110]; // use only one array, because an array contains multiple members.
Int CMP (const void * a, const void * B)
{
Return (* (move *) a). Tie-(* (move *) B). Tie;

// Because it is to sort the tie of the struct and the tie is of the int type, it adopts the fast sorting mode of the int type.

// Determine the format after return based on the type of the sorted members
}
// The above is the first-level sorting of the struct.
Int main ()
{
Int N;
Int nt, I, j;
Int sum;
While (scanf ("% d", & N), n)
{

For (I = 0; I <n; I ++)
Scanf ("% d", & num [I]. Tis, & num [I]. Tie );
Qsort (Num, N, sizeof (Num [0]), CMP );
Sum = 1;
Nt = num [0]. Tie;
For (I = 1; I <n; I ++)
{
If (Num [I]. Tis> = Nt & num [I]. Tie> NT)
{
Sum ++;
Nt = num [I]. Tie;
}
}
Printf ("% d \ n", sum );
}
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.