zoukankan      html  css  js  c++  java
  • NOIP2010 提高组 机器翻译

    题目: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;
    }
    

      

  • 相关阅读:
    程序保护机制
    ubuntu单独安装DDMS
    Linux Syste m Call Table
    任意程序添加ShellCode
    解析结构化异常处理(SEH)(第一部分)
    CONTEXT(线程结构体)
    WINNT.H
    Html的空格显示
    随机变量的联合分布
    期望和期望的性质
  • 原文地址:https://www.cnblogs.com/rainboy/p/3755161.html
Copyright © 2011-2022 走看看