P1540 机器翻译  题目

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iomanip>
#include<ctime>
#include<queue>
#include<stack>
#define rg register
#define lst long long
#define N 1050
using namespace std; int m,n,use,fir=,need;
int fy[N];
bool b[N]; inline int read()
{
rg int s=,m=;rg char ch=getchar();
while(ch!='-'&&(ch<''||ch>''))ch=getchar();
if(ch=='-')m=-,ch=getchar();
while(ch>=''&&ch<='')s=(s<<)+(s<<)+ch-'',ch=getchar();
return s*m;
} int main()
{
m=read(),n=read();
for(rg int i=;i<=n;++i)
{
rg int x=read();
if(!b[x])
{
if(use==m+fir-)
{
b[fy[fir++]]=;
}
need++;
fy[++use]=x;b[x]=;
}
}
cout<<need<<endl;
return ;
}

luoguP1540 机器翻译 题解(NOIP2010)的更多相关文章

  1. 机器翻译(noip2010)

    分析:该题是经典的队列题目,直接用队列实现就可以.如果数据范围大一些的话还可hash判重! 这可以说是一道送分的题目,但是还有粗心的学生会在这里失分,主要原因是数组的范围定义的不合适,因为空间足够用, ...

  2. luoguP1541 乌龟棋 题解(NOIP2010)

    P1541 乌龟棋 题目 #include<iostream> #include<cstdlib> #include<cstdio> #include<cma ...

  3. luoguP1525 关押罪犯 题解(NOIP2010)(并查集反集)

    P1525 关押罪犯  题目 #include<iostream> #include<cstdlib> #include<cstdio> #include<c ...

  4. luoguP1514 引水入城 题解(NOIP2010)(Bfs+贪心)

    P1514 引水入城  题目 #include<iostream> #include<cstdlib> #include<cstdio> #include<c ...

  5. 【题解】[Noip2010]机器翻译-C++

    题目Description小晨的电脑上安装了一个机器翻译软件,他经常用这个软件来翻译英语文章.这个翻译软件的原理很简单,它只是从头到尾,依次将每个英文单词用对应的中文含义来替换.对于每个英文单词,软件 ...

  6. noip2010提高组题解

    NOIP2010提高组题解 T1:机器翻译 题目大意:顺序输入n个数,有一个队列容量为m,遇到未出现元素入队,求入队次数. AC做法:直接开1000的队列模拟过程. T2:乌龟棋 题目大意:有长度为n ...

  7. NOIP2010 题解

    机器翻译 题解:模拟 #include <cstdio> #include <cstring> ; ], ]; int main(){ memset(, sizeof(in)) ...

  8. NOIP2010 机器翻译

    1机器翻译 题目背景 小晨的电脑上安装了一个机器翻译软件,他经常用这个软件来翻译英语文章. 题目描述 这个翻译软件的原理很简单,它只是从头到尾,依次将每个英文单词用对应的中文含义来替换.对于每个英文单 ...

  9. NOIP2010题解

    所有题目链接均来自洛谷 T1机器翻译 原题戳这里 自古T1是水题 因为每一个数字都小于1000,所以对于是否在队列中可以开数组查询 对于大小的限制,弄一个队列维护大小即可(水题呀...) 这题在Win ...

随机推荐

  1. 金蝶KIS客户端修改IP连接服务器的方法

    问题现象:服务器IP变更后,金蝶KIS客户端打开时提示多个错误,并会自动关闭,无法联网登录 1. 到下面位置修改注册表 Windows Registry Editor Version 5.00 [HK ...

  2. vue,一路走来(2)--路由vue-router

    安装 Mint UI cnpm install mint-ui --save 如果你的项目会用到 Mint UI 里较多的组件,最简单的方法就是把它们全部引入.此时需要在入口文件 main.js 中: ...

  3. 日期格式化:SimpleDateFormat【线程不安全】、FastDateFormat和Joda-Time【后两个都是线程安全】

    SimpleDateFormat是线程不安全的,不能多个线程公用.而FastDateFormat和Joda-Time都是线程安全的,可以放心使用. SimpleDateFormat是JDK提供的,不需 ...

  4. mysql sqlyog提示2058错误或者用Navicat连接本机Docker的Mysql 和一些问题的解决方案

    1. 下载Mysql的Docker镜像: [plain] view plain copy$ docker search mysql (搜索mysql镜像)  $ docker pull mysql ( ...

  5. Sass-加法

    程序中的运算是常见的一件事情,但在 CSS 中能做运算的,到目前为止仅有 calc() 函数可行.但在 Sass 中,运算只是其基本特性之一.在 Sass 中可以做各种数学计算 (一).加法 加法运算 ...

  6. Vue列表渲染-变异方法

    Vue 包含一组观察数组的变异方法,变异方法 (mutation method),顾名思义,会改变被这些方法调用的原始数组 所以它们也将会触发视图更新.这些方法如下: push() pop() shi ...

  7. Python3.5-20190526-廖老师-自我笔记-单元测试-参数换-paramunittest

    参数化: import timeimport list1 #想测试list1中的求和函数是否正确fun1import paramunittestimport unittest #先设置参数组@para ...

  8. SpringIntegration---MongDB

    1.依赖 <dependency> <groupId>org.springframework.integration</groupId> <artifactI ...

  9. 人生苦短_我用Python_def(函数)_004

    # coding=utf-8 # function函数:内置函数 # 例如: len int extent list range str # print insert append pop rever ...

  10. 多线程模拟生产者消费者示例之Lock

    public class Test { public static void main(String[] args) { List<String> list = new ArrayList ...