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

这样怎么会错呢? 麻烦大牛门给点数据哦

Posted by yanhaofeng at 2007-08-20 09:06:46 on Problem 3349
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define N 100010
double a[N];
int qr(const void *a,const void *b)
{ if(*(double *)a>*(double *)b)return 1;
  return 0;
}
int main()
{ int i,j,k,ii,jj,f,flag,sum,kk,kkk,n;
  double b[10],x,c[20][10];
   double  give[20],change,g;
  while(1)
  { scanf("%d",&n);
    for(i=1;i<=n;i++)
    { for(j=1;j<=6;j++)scanf("%lf",&b[j]);
      sum=1;
      for(j=1;j<=6;j++)c[sum][j]=b[j];
      sum++;
      for(j=1,ii=6;j<=6;j++,ii--)c[sum][j]=b[ii];
      k=5;
      while(k--)
      { x=b[1];
        for(j=1;j<=5;j++)b[j]=b[j+1];b[6]=x;
        sum++;
        for(j=1;j<=6;j++)c[sum][j]=b[j];
        sum++;
        for(j=1,ii=6;j<=6;j++,ii--)c[sum][j]=b[ii];
      }
         
       for(j=1;j<=12;j++)
       { //printf("j=%d sum=%d\n",j,sum);getchar();
        give[j]=0;
        for(jj=1,kkk=1;jj<=6;jj++,kkk*=10)
        { give[j]+=c[j][jj]*kkk;
          
        }
        //printf("%I64d\n",give[j]);
      }
     
     // for(j=1;j<=12;j++)printf("%I64d\n",give[j]);
      sum=12;
      for(j=1;j<=sum;j++)
      { for(jj=j+1;jj<=sum;jj++)
        { if(give[j]>give[jj])
          { change=give[j];
            give[j]=give[jj];
            give[jj]=change;
          }
        }
      }
     a[i]=give[1];
      
    }
    qsort(a+1,n,sizeof(a[0]),qr);
     flag=0;
    for(i=1;i<n;i++)
    { 
      
       if(a[i]==a[i+1])
        {flag=1;break;}
      
      //if(flag==0){f=1;break;}
    }
    if(flag==1)printf("Twin snowflakes found.\n");
    else printf("No two snowflakes are alike.\n");
    break;
  }
}
/*

2
1 2 3 4 5 6
4 3 2 1 6 5

Sample Output


Twin snowflakes found.

*/

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