Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

送上0MS代码

Posted by LXY5201314 at 2018-01-17 21:24:36 on Problem 3087
#include<stdio.h>
#include<string.h>
int main()
{
    char s1[1000],s2[1000],s12[3000],s[3000];
    int n,c,count,i,i1,i2,k;
    scanf("%d",&n);
    for(k=1;k<=n;k++)
    {
        scanf("%d",&c);
        scanf("%s",s1);
        scanf("%s",s2);
        scanf("%s",s12);
        count=0;
        while(1)
        {
            i1=0;i2=0;
            for(i=0;i<=2*c;i+=2)
            {
                s[i]=s2[i1++];
                s[i+1]=s1[i2++];
            }
            count++;
            if(strcmp(s,s12)==0)break;
            strncpy(s1,s,c);
            strcpy(s2,s+c);
            if(count==5000)break;
        }
        if(count==5000)printf("%d -1\n",k);
        else printf("%d %d\n",k,count);
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator