比赛 |
20110923 |
评测结果 |
AAAWATTTTT |
题目名称 |
横幅 |
最终得分 |
40 |
用户昵称 |
Des. |
运行时间 |
0.000 s |
代码语言 |
Pascal |
内存使用 |
0.00 MiB |
提交时间 |
2011-09-23 20:59:23 |
显示代码纯文本
program banner;
uses math;
var a,b,c,d,t,k,m,n,i,j,l1,l2:longint;
ans:int64;
p:boolean;
function gcd(a,b:longint):longint;
begin
if a mod b=0 then exit(b) else exit(gcd(b,a mod b));
end;
begin
assign(input,'banner.in');
reset(input);
assign(output,'banner.out');
rewrite(output);
readln(m,n,l1,l2);
for a:=0 to m do
for b:=0 to n do
for c:=a to m do
for d:=0 to n do
if (a<>b)or(c<>d) then
begin
p:=true;
i:=abs(a-c);
j:=abs(b-d);
if (a=c)and(abs(b-d)>1) then
p:=false
else
if (b=d)and(abs(a-c)>1) then
p:=false
else if (a<>c)and(b<>d) then
begin
if gcd(max(i,j),min(i,j))<>1 then
p:=false;
end;
if p and(sqrt(i*i+j*j)>=l1)and(sqrt(i*i+j*j)<=l2) then
inc(ans);
end;
writeln(ans);
close(output);
end.