Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
33
Task/Heronian-triangles/SPL/heronian-triangles.spl
Normal file
33
Task/Heronian-triangles/SPL/heronian-triangles.spl
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
h,t = getem(200)
|
||||
#.sort(h,4,5,1,2,3)
|
||||
#.output("There are ",t," Heronian triangles")
|
||||
#.output(" a b c area perimeter")
|
||||
#.output("----- ----- ----- ------ ---------")
|
||||
> i, 1..#.min(10,t)
|
||||
print(h,i)
|
||||
<
|
||||
#.output(#.str("...",">34<"))
|
||||
> i, 1..t
|
||||
? h[4,i]=210, print(h,i)
|
||||
<
|
||||
print(h,i)=
|
||||
#.output(#.str(h[1,i],">4>")," ",#.str(h[2,i],">4>")," ",#.str(h[3,i],">4>")," ",#.str(h[4,i],">5>")," ",#.str(h[5,i],">8>"))
|
||||
.
|
||||
getem(n)=
|
||||
> a, 1..n
|
||||
> b, #.upper((a+1)/2)..a
|
||||
> c, a-b+1..b
|
||||
x = ((a+b+c)*(a+b-c)*(a-b+c)*(b-a+c))^0.5
|
||||
>> x%1 | #.gcd(a,b,c)>1
|
||||
t += 1
|
||||
h[1,t],h[2,t],h[3,t] = #.sort(a,b,c)
|
||||
h[4,t],h[5,t] = heron(a,b,c)
|
||||
<
|
||||
<
|
||||
<
|
||||
<= h,t
|
||||
.
|
||||
heron(a,b,c)=
|
||||
s = (a+b+c)/2
|
||||
<= (s*(s-a)*(s-b)*(s-c))^0.5, s*2
|
||||
.
|
||||
Loading…
Add table
Add a link
Reference in a new issue