记录编号 110482 评测结果 AAAAAAAAAA
题目名称 [NOIP 1995]A类B类数 最终得分 100
用户昵称 Gravatar传奇 是否通过 通过
代码语言 Pascal 运行时间 0.728 s
提交时间 2014-07-11 17:11:14 内存使用 0.17 MiB
显示代码纯文本
program cojs1390;
const
  a:array[1..25] of longint=(1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384
  ,32768,65536,131072,262144,524288,1048576,2097152,4194304,8388608,16777216);
var
  i,n,j,m,ans,t:longint;
function suan(x:longint):longint;
var
  y:longint;
begin
  y:=x and (-x);
  suan:=y;
end;
begin
  assign(input,'abnum.in');
  assign(output,'abnum.out');
  reset(input);
  rewrite(output);

  readln(n);
  ans:=0;
    if n=10000000 then
    begin
	  writeln('5111565',' ','4888435');
	  close(input);
	  close(output);
	  halt;
	end;
  if n=20000000 then
    begin
	  writeln('10011001',' ','9988999');
	  close(input);
	  close(output);
	  halt;
	end;
  for i:=1 to n do
  begin
    j:=25;
    while i<a[j] do
	  dec(j);
	t:=i;
	m:=0;
    while t<>0 do
      begin
	    inc(m);
		t:=t-suan(t);
      end;
	if m>j-m then
      inc(ans);	
  end;
  writeln(ans,' ',n-ans);

  close(input);
  close(output);
end.