标签:des style blog http color java os io
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2482 Accepted Submission(s): 773
1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 using namespace std; 5 int main() 6 { 7 int n,j,i,k,a[1005],v[1005]; 8 while(~scanf("%d",&n)) 9 { 10 for(i=1;i<=n;i++) 11 scanf("%d",&a[i]); 12 memset(v,0,sizeof(v)); 13 int cnt=0; 14 int flag=0; 15 while(cnt<n) 16 { 17 for(i=1;i<=n;i++) 18 { 19 if(v[i]==1) 20 continue; 21 k=0; 22 for(j=i+1;j<=n&&k<=5;j++) 23 { 24 if(v[j]==1) 25 continue; 26 if(a[i]==a[j]) 27 { 28 v[i]=v[j]=1; 29 break; 30 } 31 k++; 32 } 33 } 34 cnt++; 35 } 36 for(i=1;i<=n;i++) 37 { 38 if(v[i]==0) 39 { 40 printf("0\n"); 41 break; 42 } 43 } 44 if(i>n) 45 printf("1\n"); 46 47 } 48 return 0; 49 }
HDU-4272 LianLianKan,布布扣,bubuko.com
标签:des style blog http color java os io
原文地址:http://www.cnblogs.com/cancangood/p/3898652.html