Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
32
Task/General-FizzBuzz/Maple/general-fizzbuzz.maple
Normal file
32
Task/General-FizzBuzz/Maple/general-fizzbuzz.maple
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
findNum := proc(str) #help parse input
|
||||
local i;
|
||||
i := 1:
|
||||
while (true) do
|
||||
if (StringTools:-IsAlpha(str[i])) then
|
||||
return i-2:
|
||||
end if:
|
||||
i := i+1:
|
||||
end do:
|
||||
end proc:
|
||||
path := "input.txt";
|
||||
input := readline(path):
|
||||
T := table():
|
||||
maxnum := parse(input):
|
||||
while (true) do
|
||||
input := readline(path):
|
||||
if input = 0 then break; end if:
|
||||
pos := findNum(input):
|
||||
num := parse(input[..pos]):
|
||||
T[num] := input[pos+2..]:
|
||||
end do:
|
||||
for i from 1 to maxnum do
|
||||
factored := false:
|
||||
for j in [indices(T)] do
|
||||
if i mod j[1] = 0 then
|
||||
factored := true:
|
||||
printf(T[j[1]]);
|
||||
end if:
|
||||
end do:
|
||||
if (not factored) then printf("%d", i): end if:
|
||||
printf("\n");
|
||||
end do:
|
||||
Loading…
Add table
Add a link
Reference in a new issue