link:http://acm.csu.edu.cn/OnlineJudge/problem.php?cid=2024&pid=1

基础的字符串处理的题目,只要注意细节就好了,两个注意点:1)一个队伍可能有题目no有做出来,2)题目一次ac,可能no有出错。。(不知道为嘛这blog的mei打不出。。。。)

下面是我的代码:

#include <stdio.h>

#include <string.h>
int main()
{
    char name[100],t[6][100];
    char s[2000],a[6][100];
    int i,j,k;
    while(scanf("%s",name)!=EOF)
    {
        memset(t,0,sizeof(t));
        memset(a,0,sizeof(a));
        gets(s);
        for(i=1,j=0,k=0;s[i];i++)
        {
            if(s[i]==9)
            {
                j++;
                k=0;
            }
            else
            {
                t[j][k++]=s[i];
            }
        }
        gets(s);
        for(i=1,j=0,k=0;s[i];i++)
        {
            if(s[i]==9)
            {
                j++;
                k=0;
            }
            else
            {
                a[j][k++]=s[i];
            }
        }
        printf("%s\t",name);
        for(i=0;i<5;i++)
        {
            printf("%s%s",t[i],a[i]);
            if(i!=4)
                printf("\t");
        }
        printf("\n");
    }
    return 0;
}

One Thought on “集训赛之csu暑期检测——处理RankList

  1. alice on 2012/07/31 at 03:33 said:

    ”没“打不出来吗?

发表评论

电子邮件地址不会被公开。

Post Navigation