
-----------------------------------
JSBN
Tue Feb 25, 2003 11:01 am

My solutions
-----------------------------------
Ok, Many of you probably did the competition today. It was easy (for me) untill i hit the poetry question, which i did not finnish. here are my answers for the first 3 questions of the competition. I will try to put up what was required ASAP:

Question 1 (Trident)

var t : int
var s : int
var h : int


put "Enter tine length:"
get t
put "Enter tine spacing:"
get s
put "Enter handle lenght:"
get h


for i1 : 1 .. t

    for i2 : 1 .. 3
        put "*" ..

        for i3 : 1 .. s
            put " " ..
        end for

    end for

    put ""

end for

if s = 0 then
else
    for i4 : 1 .. (5 + s * 2) - 2
        put "*" ..
    end for
    put ""
end if

for i5 : 1 .. h
    for i6 : 1 .. s + 1
        put " " ..
    end for
    put "*"
end for


Question 2 (Pictures)

%LARGER AMOUNTS OF PICTURES WILL REQUIRE MORE TIME FOR CALCULATION
var C : int
var z : int
var t2 : int
var d1 : int
var d2 : int

loop

    put "Enter number of pictures"
    get C
    t2 := 65000
    exit when C = 0
    for i1 : 1 .. C
        for i2 : 1 .. C
            z := i1 * i2

            if z = C then
                if (i1 + i2) * 2  100 then
    else
        loca := loca + sum
    end if
    if loca = 9 then
        loca := 34
    elsif loca = 40 then
        loca := 64
    elsif loca = 67 then
        loca := 86
    elsif loca = 99 then
        loca := 77
    elsif loca = 90 then
        loca := 48
    elsif loca = 54 then
        loca := 19
    end if



    put "You are now on square ", loca
    exit when loca = 100
end loop
put "You Win!"


-----------------------------------
Tony
Tue Feb 25, 2003 11:28 am


-----------------------------------
nice, thats 3*15 = 45? Id say better then half the people.

I'll upload poetry, floorplan, subtrings when I get a comfirmation that they're correct. Unfortunatly I wasn't able to solve S5 - Trucks in the remaining 30 minutes and I'll be kicking myself... but mostly my teacher for the whole end of the year if that would cost me my stage 2  :evil: 

Right now my score suppost to be 60.  :? 

Can someone post a solution to trucks problem?!

-----------------------------------
Asok
Tue Feb 25, 2003 12:06 pm


-----------------------------------
for amusement purposes take a look at my rediculously longer (still works) version of J2:

var picnum : int
var x, y : real
var counter : int := 0
x := 10
y := 1
loop
    put "Enter number of pictures:"
    get picnum
    if picnum = 0 then
        exit
    end if
    counter := 0
    var total : array 1 .. picnum of real
    var integers : array 1 .. picnum of int
    var finished : array 1 .. picnum of real
    var perimeter : array 0 .. picnum of real
    var smallest : real := 999999
    for i : 1 .. picnum
        integers (i) := i
    end for
    for i : 1 .. picnum
        total (i) := picnum / i
        for k : 1 .. picnum
            if total (i) = integers (k) then
            counter := counter + 1
                finished (counter) := total (i)
            end if
        end for
    end for
    for l : 1 .. counter
        perimeter (l) := finished (l) * 2 + finished (counter - l+1) * 2
       if perimeter (l) < smallest then
             smallest := perimeter (l)
             x:= finished (l)
             y:= finished (counter - l+1)
        end if
    end for
    put "Minimum perimeter is ", smallest, " with dimensions ", y, " x ", x
    put " "
end loop

and JSBN, your J3 is incorrect, you're missing:
if roll >=2 and roll 