var a:array [1..10000] of integer;
i,n,m,s,x,j,q:integer;
begin
readln(m,n);
s:=0;
for i:=1 to n do
begin
q:=0;
read(x);
for j:=1 to m do
if a[j]=x then q:=1;
if q=0 then
begin
s:=s+1;
for j:=m downto 1 do
a[j+1]:=a[j];
a[1]:=x;
end;
end;
writeln(s);
end.
状态: Unaccepted
测评机: Xeond[6]
得分: 90分
提交日期: 2011-8-19 22:06:00
有效耗时: 1125毫秒
RQNOJ近期在线比赛列表
RQNOJ八月份月赛 时间:2011-8-27 18:00:00 [报名]
测试结果1: 通过本测试点|有效耗时172ms
测试结果2: 通过本测试点|有效耗时47ms
测试结果3: 通过本测试点|有效耗时46ms
测试结果4: 通过本测试点|有效耗时172ms
测试结果5: 通过本测试点|有效耗时47ms
测试结果6: 通过本测试点|有效耗时156ms
测试结果7: 通过本测试点|有效耗时157ms
测试结果8: 通过本测试点|有效耗时156ms
测试结果9: 测试结果错误.错误结果为:295
正确结果应为:297
测试结果10: 通过本测试点|有效耗时172ms
#include<iostream>
using namespace std;
int wo[100];
int main()
{
int a,b,c,d,e,f,g,ans;
cin>>a>>b;
d=0;
ans=0;
for(c=1;c<=b;c++)
{
cin>>e;
g=0;
for(f=1;f<=d;f++)
{
if(e==wo[f])
{
g=1;
break;
}
}
if(g==0)
{
ans++;
if(d==a)
{
for(f=1;f<d;f++)
wo[f]=wo[f+1];
wo[d]=e;
}
if(d<a)
{
d++;
wo[d]=e;
}
}
}
cout<<ans<<endl;
return 0;
}