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<stdlib.h> int main() { int i,j,list[2001],data[2001],number,flag,p,n,m,t,zong; for(zong=1;;zong++) { number=0; scanf("%d %d",&n,&m); if(n!=0||m!=0) { for(i=1;i<=n*m;i++) { list[i]=i; } for(i=0;i<m;i++) { scanf("%d",&data[i]); list[data[i]]=0; } for(i=0;i<m-1;i++) { for(j=0;j<m-i-1;j++) { if(data[j]<data[j+1]) { t=data[j]; data[j]=data[j+1]; data[j+1]=t; } } } for(i=0;i<m;i++) { flag=0; for(j=0;j<=n*m;j++) { if(list[j]>data[i]) { list[j]=0; flag=1; break; } } if(flag==0) { number++; } } printf("Case %d: %d\n",zong,number); } else { break; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator