Xiao Xin's Daily series of stories (10)--ranked Times

Source: Internet
Author: User
Xiao Xin's Daily series of stories (10)--ranked TimesTime limit:1000ms Memory limit:65536kb Submit statistic Problem DescriptionXiao Xin came to Sdut after, after very hard study and efforts finally entered the ACM team. Soon another ACM team's selection is about to begin, and the training teams are busy again.  He was also very fortunate to be a senior to be caught as coolie. O (∩_∩) o This seniors assigned him the task is to write an automatic ranking program, we know that when the end of the tryouts, each of the students involved in the selection will have a score of their own. and team need according to everyone's score ranking to decide who can enter the team, this task fell on Xiao Xin body. Can you help Xiao Xin to finish this program? InputThe first behavior of the input n 0<n<=50; Below there are n rows for each act a person's name and TA's score. Guaranteed not to have the same score. People's names are English words, no more than 10 in length. OutputThe output is n rows, each line a person's name with his score. There are no extra spaces at the end of each line. The specific output format is shown in the sample example. Example Input
3
Dan
John
Danny 30
Example Output
John
Danny
Dan 10
#include <stdio.h>
#include <string.h>
int main ()
{
    int n,shu[60],t;
    int j,i;
    Char a[60][20],at[20];
    scanf ("%d", &n);
    for (i = 0;i < n;i++)
    {
        scanf ("%s", A[i]);
        scanf ("%d", &shu[i]);
    for (i = 0;i <= n-1;i++)
    {for
       (j = 0;j <= n-2-i;j++)
       {
           if (shu[j]<shu[j+1])
           {
               t= shu[j],shu[j]=shu[j+1],shu[j+1]=t;
               strcpy (At,a[j]);
               strcpy (a[j],a[j+1]);
               strcpy (a[j+1],at);
    }} for (i = 0;i <= n-1;i++)
    {
        printf ("%s%d\n", A[i],shu[i]);
    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.