5
自己编的
program sequence(input,output);{$r-,s-,q-}vara:array[1..10] of 0..1;input,output:text;x,y,n,w:longint;i:longint;s:longint;function xny(a,b,c:longint):longint;vartv:integer;beginc:=1;for tv:=1 to b doc:=c*a;xny:=c;end;beginfor i:=1 to 10 doa[i]:=0;s:=0;assign(input,'sequence.in');reset(input);readln(input,n,w);close(input);i:=10;while w>0 dobegina[i]:=w mod 2;w:=w div 2;i:=i-1;end;for i:=1 to 10 do writeln(a[i]);for i:=10 downto 1 dobeginif a[i]=1 then s:=s+xny(n,10-i,y);end;assign(output,'sequence.out');rewrite(output);writeln(output,s);close(output);end.
哪位大虾优化一下input: [‘input] n. 输入
2006-12-20
5