tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
|
|
@ -0,0 +1,31 @@
|
|||
; Known;
|
||||
; A.
|
||||
; [ 151]
|
||||
; [a ][b ]
|
||||
; [40][c ][d ]
|
||||
; [e ][f ][g ][h ]
|
||||
; [ X][11][ Y][ 4][ Z]
|
||||
;
|
||||
; B.
|
||||
; Y = X + Z
|
||||
|
||||
Procedure.i SolveForZ(x)
|
||||
Protected a,b,c,d,e,f,g,h,z
|
||||
For z=0 To 20
|
||||
e=x+11: f=11+(x+z): g=(x+z)+4: h=4+z
|
||||
If e+f=40
|
||||
c=f+g : d=g+h: a=40+c: b=c+d
|
||||
If a+b=151
|
||||
ProcedureReturn z
|
||||
EndIf
|
||||
EndIf
|
||||
Next z
|
||||
ProcedureReturn -1
|
||||
EndProcedure
|
||||
|
||||
Define x=-1, z=0, title$="Pascal's triangle/Puzzle in PureBasic"
|
||||
Repeat
|
||||
x+1
|
||||
z=SolveForZ(x)
|
||||
Until z>=0
|
||||
MessageRequester(title$,"X="+Str(x)+#CRLF$+"Y="+Str(x+z)+#CRLF$+"Z="+Str(z))
|
||||
Loading…
Add table
Add a link
Reference in a new issue