/ SB域 /

记录详情

Accepted

/usr/bin/ld.bfd: warning: /out/link.res contains output sections; did you forget -T?
# 状态 耗时 内存占用
#1 Accepted 7ms 9.75 MiB
#2 Accepted 4ms 9.84 MiB
#3 Accepted 7ms 9.75 MiB
#4 Accepted 7ms 9.75 MiB
#5 Accepted 7ms 9.875 MiB
#6 Accepted 5ms 10.125 MiB
#7 Accepted 8ms 10.332 MiB
#8 Accepted 10ms 11.5 MiB
#9 Accepted 8ms 11.5 MiB
#10 Accepted 7ms 11.598 MiB

代码

var n,m,i:longint;
    a:array[0..500000]of longint;
    u:array[0..10000000]of boolean;
begin
 readln(n);
 fillchar(u,sizeof(u),false);
 a[0]:=0; a[1]:=1;
 u[0]:=true; u[1]:=true;
 m:=2;
 while m<=n do begin
  if (a[m-1]-m>0)and(u[a[m-1]-m]=false)
  then begin a[m]:=a[m-1]-m; u[a[m]]:=true;end
  else begin a[m]:=a[m-1]+m; u[a[m]]:=true;end;
 inc(m);
 end;
 writeln(a[n]);
close(input);
close(output);
end.

信息

递交者
类型
递交
题目
雷卡曼序列
题目数据
下载
语言
Pascal
递交时间
2017-08-22 14:24:56
评测时间
2017-08-22 14:24:56
评测机
分数
100
总耗时
75ms
峰值内存
11.598 MiB