Fairshare between two and more: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 1,423: | Line 1,423: | ||
=={{header|Ring}}== |
=={{header|Ring}}== |
||
<lang ring> |
<lang ring> |
||
str = [] |
str = [] |
||
people = [2,3,5,11] |
people = [2,3,5,11] |
||
result = list(len(people)) |
|||
result = people |
|||
for i in people |
|||
str = [] |
str = [] |
||
see "" + |
see "" + i + ": " |
||
fair(25, i) |
|||
for n |
for n in result |
||
add(str, |
add(str,n) |
||
next |
next |
||
showarray(str) |
showarray(str) |
||
next |
next |
||
⚫ | |||
⚫ | |||
result = list(n) |
result = list(n) |
||
for i=1 to n |
for i=1 to n |
||
j = i-1 |
j = i-1 |
||
t = 0 |
t = 0 |
||
while j>0 |
while j>0 |
||
t = t + j % base |
t = t + j % base |
||
j = floor(j/base) |
j = floor(j/base) |
||
Line 1,447: | Line 1,449: | ||
result[i] = t % base |
result[i] = t % base |
||
next |
next |
||
return [base,result] |
|||
⚫ | |||
⚫ | |||
see "[" |
|||
svect = "" |
svect = "" |
||
for n |
for n in vect |
||
svect = |
svect += " " + n + "," |
||
next |
next |
||
svect = left(svect, len(svect) - 1) |
svect = left(svect, len(svect) - 1) |
||
see svect |
|||
? "[" + svect + "]" |
|||
</lang> |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |