Advertisement
Sorceress

2018-09

Dec 9th, 2018
1,672
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QBasic 0.88 KB | None | 0 0
  1. DEFLNG A-Z
  2. TYPE tLL
  3.   d AS LONG
  4.   n AS LONG
  5.   p AS LONG
  6. END TYPE
  7. DIM LL(10000000) AS tLL
  8. DIM s(1000) AS LONG
  9. DIM shi(1000) AS LONG
  10.  
  11. players = 476: marbles = 7143100
  12.  
  13. FOR m = 1 TO marbles
  14.  
  15.   i = LL(i).n: i = LL(i).n: inext = LL(i).n
  16.   py = py + 1: IF py > players THEN py = py - players
  17.   IF m MOD 23 = 0 THEN
  18.     s(py) = s(py) + m
  19.     FOR h = 1 TO 8: i = LL(i).p: NEXT
  20.     iprev = LL(i).p
  21.     inext = LL(i).n
  22.     LL(iprev).n = inext
  23.     LL(inext).p = iprev
  24.     s(py) = s(py) + LL(i).d
  25.  
  26.   ELSE
  27.     t = t + 1:
  28.     LL(i).n = t: LL(t).n = inext: LL(t).d = m
  29.     LL(inext).p = t: LL(t).p = i
  30.   END IF
  31.   WHILE s(py) > 100000: s(py) = s(py) - 100000: shi(py) = shi(py) + 1: WEND
  32. NEXT
  33.  
  34. FOR py = 1 TO players
  35.   IF shi(py) > shi(bestpy) THEN bestpy = py: PRINT shi(py); s(py)
  36.   IF shi(py) = shi(bestpy) AND s(py) > s(bestpy) THEN bestpy = py: PRINT shi(py); s(py)
  37. NEXT
  38. PRINT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement