luoguP1540 机器翻译 题解(NOIP2010)
#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)的更多相关文章
- 机器翻译(noip2010)
分析:该题是经典的队列题目,直接用队列实现就可以.如果数据范围大一些的话还可hash判重! 这可以说是一道送分的题目,但是还有粗心的学生会在这里失分,主要原因是数组的范围定义的不合适,因为空间足够用, ...
- luoguP1541 乌龟棋 题解(NOIP2010)
P1541 乌龟棋 题目 #include<iostream> #include<cstdlib> #include<cstdio> #include<cma ...
- luoguP1525 关押罪犯 题解(NOIP2010)(并查集反集)
P1525 关押罪犯 题目 #include<iostream> #include<cstdlib> #include<cstdio> #include<c ...
- luoguP1514 引水入城 题解(NOIP2010)(Bfs+贪心)
P1514 引水入城 题目 #include<iostream> #include<cstdlib> #include<cstdio> #include<c ...
- 【题解】[Noip2010]机器翻译-C++
题目Description小晨的电脑上安装了一个机器翻译软件,他经常用这个软件来翻译英语文章.这个翻译软件的原理很简单,它只是从头到尾,依次将每个英文单词用对应的中文含义来替换.对于每个英文单词,软件 ...
- noip2010提高组题解
NOIP2010提高组题解 T1:机器翻译 题目大意:顺序输入n个数,有一个队列容量为m,遇到未出现元素入队,求入队次数. AC做法:直接开1000的队列模拟过程. T2:乌龟棋 题目大意:有长度为n ...
- NOIP2010 题解
机器翻译 题解:模拟 #include <cstdio> #include <cstring> ; ], ]; int main(){ memset(, sizeof(in)) ...
- NOIP2010 机器翻译
1机器翻译 题目背景 小晨的电脑上安装了一个机器翻译软件,他经常用这个软件来翻译英语文章. 题目描述 这个翻译软件的原理很简单,它只是从头到尾,依次将每个英文单词用对应的中文含义来替换.对于每个英文单 ...
- NOIP2010题解
所有题目链接均来自洛谷 T1机器翻译 原题戳这里 自古T1是水题 因为每一个数字都小于1000,所以对于是否在队列中可以开数组查询 对于大小的限制,弄一个队列维护大小即可(水题呀...) 这题在Win ...
随机推荐
- react native 之 Android studio
https\://services.gradle.org/distributions/gradle-4.4-all.zip 下载失败 https://blog.csdn.net/u013132758/ ...
- 解决Layui数据表格中checkbox位置不居中
1.情景 使用方法渲染的方式生成数据表格,添加了checkbox,但发现checkbox位置不居中,如下图所示 2.解决办法 通过layui官方社区,找到如下代码,只需要添加如下样式即可解决 < ...
- Windows下svn使用教程
SVN简介: 为什么要使用SVN? 程序员在编写程序的过程中,每个程序员都会生成很多不同的版本,这就需要程序员有效的管理代码,在需要的时候可以迅速,准确取出相应的版本. Subversion是什么? ...
- 2019-1-5-Windows-的-Pen-协议
title author date CreateTime categories Windows 的 Pen 协议 lindexi 2019-01-05 11:14:49 +0800 2019-01-0 ...
- smbstatus - 报告当前 samba 的联接状态
总览 smbstatus [-b] [-d] [-L] [-p] [-S] [-s configuration file] [-u username] 描述 此程序是 samba 套件的一部分. sm ...
- 05.Linux-CentOS系统普通用户SSH远程问题
问题:appuser用户SSH远程连接Linux服务器出现的问题: Connecting?to?localhost:22...Connection?established.To?escape?to?l ...
- 给定中序和后序遍历,求前序序列(C++递归方式实现)
问题: 输入后序和中序,求中序遍历. 算法: void f2(string &pre,string in, string post) { ) //序列为空结束 return; ; //根节点 ...
- procixx 时钟的坑
error 1.procixx设置800M,uboot中是720M 了解到整个过程是,当procixx配置后,通过FSBL中的ps_init.c反应出来 // ARM_PLL_FDIV = 48 ...
- spring整合消息队列rabbitmq
ps:本文只是简单一个整合介绍,属于抛砖引玉,具体实现还需大家深入研究哈.. 1.首先是生产者配置 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...
- 第02章 IOC和bean的配置
第02章 IOC容器和Bean的配置 1.IOC和DI ①IOC(Inversion of Control):反转控制. 在应用程序中的组件需要获取资源时,传统的方式是组件主动的从容器中获取所需要的资 ...