Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这样怎么会错呢? 麻烦大牛门给点数据哦#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator