fork download
  1. #module
  2. #deffunc swap var a, var b, local t
  3. t=a
  4. a=b
  5. b=t
  6. return
  7.  
  8. #defcfunc cmp str a_, str b_, local a, local b, local a_len, local b_len, local ret
  9. a=a_
  10. b=b_
  11. a_len=strlen(a)
  12. b_len=strlen(b)
  13. if a_len!b_len : return a_len-b_len
  14. repeat a_len
  15. if peek(a, cnt)!peek(b, cnt) {
  16. ret=peek(a, cnt)-peek(b, cnt)
  17. break
  18. }
  19. loop
  20. return ret
  21.  
  22. #deffunc result_add array result, str add_member, local i
  23. result.length(result)=add_member
  24. for i, length(result)-1, 0, -1
  25. if cmp(result(i), result(i-1))>=0 : _break
  26. swap result(i), result(i-1)
  27. next
  28. return
  29.  
  30. #deffunc solve array result, local index
  31. sdim result
  32. result.0="1"
  33. repeat
  34. if length(result)>=1001 : break
  35. result_add result, result.index+"0"
  36. result_add result, result.index+"01"
  37. index++
  38. loop
  39. return
  40.  
  41. #global
  42.  
  43. solve result
  44. buf=""
  45. repeat 1000
  46. buf+=result.cnt+"\n"
  47. loop
  48.  
  49. mesbox buf, ginfo_sx, ginfo_sy
  50.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty