1樓:匿名使用者
program gfgff
vari,j,n,c:longint;
t:qword;
a:array[0..300000]of longint;
b:array[0..300000]of int64;
procedure swap(var a,b:longint);
vartemp:longint;
begin
temp:=a;
a:=b;
b:=temp;
end;
procedure sort(l,r:longint);
vari,j,x:longint;
begin
i:=l;j:=r;x:=a[(l+r)shr 1];
repeat
while a[i]x do dec(j);
if i<=j then
begin
swap(a[i],a[j]);
inc(i);dec(j);
end;
until i>j;
if l=r;
if (a[l]=x)and(l<=n) then exit(l);
if (a[r]=x)and(r>=1) then exit(r);
exit(0);
end;
begin
assign(input,'dec.in');reset(input);
readln(n,c);
for i:=1 to n do read(a[i]);
close(input);
sort(1,n);
j:=0;
a[0]:=a[1]-1;
for i:=1 to n do
begin
if a[i]=a[i-1] then inc(j);
a[i-j]:=a[i];
inc(b[i-j]);
end;
n:=n-j;
t:=0;
if c=0 then
for i:=1 to n do
t:=t+b[i]*(b[i]-1)div 2else
for i:=1 to n do
begin
t:=t+b[i]*b[find(c+a[i])];
writeln(find(c+a[i]));
end;
for i:=1 to n do writeln(a[i],' ',b[i]);
assign(output,'dec.out');rewrite(output);
writeln(t);
close(output);
end.
2樓:巧克力
1.var
i,j,n,c:longint;
t:qword;
a:array[0..300000]of longint;
b:array[0..300000]of int64;
procedure swap(var a,b:longint);
vartemp:longint;
begin
temp:=a;
a:=b;
b:=temp;
end;
procedure sort(l,r:longint);
vari,j,x:longint;
begin
i:=l;j:=r;x:=a[(l+r)shr 1];
repeat
while a[i]x do dec(j);
if i<=j then
begin
swap(a[i],a[j]);
inc(i);dec(j);
end;
until i>j;
if l=r;
if (a[l]=x)and(l<=n) then exit(l);
if (a[r]=x)and(r>=1) then exit(r);
exit(0);
end;
begin
assign(input,'dec.in');reset(input);
readln(n,c);
for i:=1 to n do read(a[i]);
close(input);
sort(1,n);
j:=0;
a[0]:=a[1]-1;
for i:=1 to n do
begin
if a[i]=a[i-1] then inc(j);
a[i-j]:=a[i];
inc(b[i-j]);
end;
n:=n-j;
t:=0;
if c=0 then
for i:=1 to n do
t:=t+b[i]*(b[i]-1)div 2
else
for i:=1 to n do
begin
t:=t+b[i]*b[find(c+a[i])];
// writeln(find(c+a[i]));
end;
// for i:=1 to n do writeln(a[i],' ',b[i]);
assign(output,'dec.out');rewrite(output);
writeln(t);
close(output);
end.
2.var
tot,n,i,j,n1:longint;
pre,next,b,a:array[0..20]of longint;
l,r,s:array[-20..20]of longint;
ch:char;
procedure try(deep,y,z:longint);
vari:longint;
begin
if deep>n then
begin
inc(tot);
exit;
end;
i:=next[0];
repeat
if a[deep] and s[i]<>0 then
if y and l[deep+i]<>0 then
if z and r[deep-i]<>0 then
begin
pre[next[i]]:=pre[i];
next[pre[i]]:=next[i];
try(deep+1,y xor l[deep+i],z xor r[deep-i]);
next[pre[i]]:=i;
pre[next[i]]:=i;
end;
i:=next[i];
until i>n;
end;
begin
assign(input,'queens.in');reset(input);
readln(n);
for i:=1 to n do
begin
for j:=1 to n do
begin
read(ch);
if ch='*' then
a[i]:=a[i] xor (1 shl (j-1));
end;
readln;
end;
close(input);
for i:=0 to n+1 do
next[i]:=i+1;
for i:=0 to n+1 do
pre[i]:=i-1;
n1:=1 shl n-1;
b[n+1]:=n1;
for i:=n downto 1 do
b[i]:=b[i+1] or a[i];
for i:=1 to n do
s[i]:=1 shl (i-1);
r[1-n]:=1;
for i:=1-n+1 to n-1 do
r[i]:=r[i-1] shl 1;
l[1+1]:=1;
for i:=1+1+1 to n+n do
l[i]:=l[i-1] shl 1;
try(1,1 shl (n+n-1)-1,1 shl (n+n-1)-1);
assign(output,'queens.out');rewrite(output);
writeln(tot);
close(output);
end.
求解幾道英語題
3樓:一線口語
8-12 abcbc
4樓:匿名使用者
8 b9 b
10 a
11 b
12 a
5樓:我叫鄰家小夥伴
abcbc,差不多就是這樣啦
求解幾道小學奧數題,求解幾道小學奧數題,精確詳解的追加懸賞!
第一題 4。因為去除的2個正整數總和12,所以有可能是11 1,10 2。因為如果是9 3,那麼中間數只剩下4,5,6,7,8了,不夠6個數。如果是10 2,那麼中間數最大可能值是4 5 6 7 8 9 39,也不對。那麼去除的只能是11和1.同時由於5 6 10 45.45 44 1.所以,這6個...
求解幾道線性代數題,急需,求解幾道線性代數題
1 否,反例 有 1 1,0,0 2 0,1,0 3 0,0,0 顯然 1,2,3線性相關,而 1,2線性無關。2 是,由線性相關得到,a1,a2,a s 的秩小於s,設秩為r,其線性組合a1 a2,a2 a3.a s 1 a s a s a1的秩r1,不大於r再有a1 a2,a2 a3.a s 1...
幾道英語題,求解析
1.不可以用in search of 雖然意思沒有問題,但是句中情態動詞can後面必須要加上動詞原形才能一起做謂語。如果用介詞短語in search of,則此句就缺少謂語,就不構成一個句子了。2.也不可以。根據句意,選項為目的狀語,但是現在分詞一般是不能做目的狀語的。可以使用不定式短語 to se...