📄 ac1119.pas
字号:
program tju1119;
var
n,i:word;
begin
repeat
read(n);
if (n=2) or (n=3) or (n=5) then
writeln('Yes')
else begin
writeln('No');
if odd(n) then write('2 1 1 1') else write('2 3 3 3');
for i:=5 to n do
write(' 3');
writeln;
end;
until seekeof;
end.
{
The hard thing of this prob is to prove Fan(5)>=0 always holds.
Proof:
Denote the five numbers by a,b,c,d,e, sorted by increasing order.
Let A=(a-b)(a-c)(a-d)(a-e), and the similar for B,C,D,E.
Obviously A,C,E>=0, B,D<=0.
Compare |A| and |B|:
Because |a-b|=|b-a|,|a-c|>=|b-c|,|a-d|>=|b-d|,|a-e|>=|b-e|
Therefore |A|>=|B|.
So A+B>=0.
Similarly we can obtain that D+E>=0.
Also because C>=0, therefore A+B+C+D+E>=0, i.e. Fan(5)>=0 always holds.
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -