题目:http://www.tsinsen.com/ViewGProblem.page?gpid=A1182
解析:题目比较简单,应用了对列(数组模拟)
评测:
/* * ===================================================================================== * * Filename: Noip2010jiqifanyi.c * * Description: RT * * Version: 1.0 * Created: 2014-05-27 14:25:14 * Revision: none * Compiler: gcc * * Author: Rainboy (mn), 597872644@qq.com * Company: NONE * * ===================================================================================== */ #include <stdio.h> int M,N; int queue[1001]= {0}; int article[1001]= {0}; int head=0,tail=0; int main(int argc, const char *argv[]) { int i,j,Bfind,count=0; scanf("%d%d",&M,&N); for (i = 0; i < N; i++) { scanf("%d",&article[i]); } queue[head] = article[0]; count = 1; for (i = 0; i < N; i++) { Bfind = 0; for (j = head; j <= tail; j++) { if (queue[j] == article[i]) { Bfind = 1; break; } } if(!Bfind) { if ((tail-head+1) == M) { tail++; head++; count++; queue[tail]=article[i]; } else { tail++; count++; queue[tail] = article[i]; } } } printf("%d ",count); return 0; }