NYOJ277 license plate Number String size comparison __ String

Source: Internet
Author: User
Tags strcmp first row
License plate numberTime limit: 3000 ms | Memory limit: 65535 KB Difficulty: 1 Description Yan is very like to study the license plate number, from the license plate number can be seen registration of the morning and evening, according to the study found that the license plate number is issued according to the dictionary, and now she collects a lot of license plate number, please design procedures to help her judge the registration of The license plate number is composed of 5 letters or numbers. Enter the first row is N, the Representative has n group of data, the second row is M, the following m line is m license plate number
Where the n<100,m<1000 output registration of an earlier license plate number sample input
1
4
AA100
aa100
0o2r4
ye2er
Sample output

0o2r4


Analytical:

strcpy (S1,S2); s1 the string into S2.

strcmp (S1,S2); compares s1,s2 size, s1>s2, returns a positive value, S1=S2, returns a negative value for 0,S1<S2.

The procedure is as follows:

#include <cstdio>
#include <cstring>
int main ()
{
	int t;
	Char a[1003][6]; 
	scanf ("%d", &t);
	while (t--)
	{
		int m,i;
		Char min[6];
		scanf ("%d", &m);
		for (i=0;i<m;i++)
		    scanf ("%s", A[i]);
		strcpy (Min,a[0]);
		for (i=1;i<m;i++)
		    if (strcmp (a[i],min) <0)
		       strcpy (min,a[i));
		printf ("%s\n", min);
	}
	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.