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

Re:各位大神求救;熬夜提交30多次,全部失败并且测试全部通过

Posted by zzt123 at 2011-11-21 14:16:14 on Problem 1002
In Reply To:各位大神求救;熬夜提交30多次,全部失败并且测试全部通过 Posted by:puke at 2011-11-19 00:45:31
> #include<stdio.h>
> #include<string.h>
> void standard();
> void main()
> { char tel[100][30],p[7];
>   int i,j,k,l;
>   int number,times[100];
>   scanf("%d",&number);
>   getchar();
>   for(i=0;i<number;i++)
>   {gets(tel[i]);
>   standard(tel[i]);
>    }
>  for(i=0;i<number;i++)
>   {for(j=i+1;j<number;j++)
>         {   if(strcmp(tel[i],tel[j])==0)
>              {for(k=j;k<number-1;k++)
>                  strcpy(tel[k],tel[k+1]);
>               number--;
>               times[i]++;
>               j--;
>              }
>          }
>    if(times[i]==0)
>    {for(l=i;l<number-1;l++)
>       strcpy(tel[l],tel[l+1]);
>       if(i<number-1)i--;
>    number--;
>    }
>   }
>      for(i=0;i<number-1;i++)
>         for(j=i+1;j<number;j++)
>            for(k=0;k<7;k++)
>            {  if(tel[i][k]>tel[j][k])
>                {
>                strcpy(p,tel[i]);
>                strcpy(tel[i],tel[j]);
>                strcpy(tel[j],p);
>                l=times[i];times[i]=times[j];times[j]=l;
>                break;
>                }
>                else if(tel[i][k]<tel[j][k])break;
>            }
>   if(number==0)printf("No duplicates.");
>   else for(i=0;i<number;i++)
>   printf("%c%c%c-%c%c%c%c %d\n",tel[i][0],tel[i][1],tel[i][2],tel[i][3],tel[i][4],tel[i][5],tel[i][6],times[i]+1);
> }
> void standard(char from[])
>   {char  a[25]={'2','2','2','3','3','3','4','4','4','5','5','5','6','6','6','7','7','7','7','8','8','8','9','9','9'};
>   int m,n,k;
>     m=0;
>     while(from[m]!='\0')
>       {if(from[m]=='-')
>          {for(n=m;n<30;n++)
>            from[n]=from[n+1];
>            m--;
>           }
>        else if(from[m]>='A'&&from[m]<='Y')
>        from[m]=a[from[m]-'A'];
>        m++;
>       }
>      from[7]='\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