讨论 / 题目:[NOIP2010]机器翻译 求修改 求AC
tym983398371 2011-08-30 06:44:00
点我顶贴 收藏 删除
program Project1;

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

#1 2013cqf@2011-08-27 07:15:00
回复 删除
这是我的代码,你比较一下吧,虽然我写的有些丑。

#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;

}

#2 tym983398371@2011-08-27 22:41:00
回复 删除
我是pascal。。。。。。

RT

#3 earoke@2011-08-30 06:44:00
回复 删除
我联赛时也90,数组应初始化为负数。(数据中有0)
查看更多回复
提交回复