linux40
V2EX  ›  C

为什么我写的 josephus 会崩?

  •  1
     
  •   linux40 · Nov 8, 2015 · 1741 views
    This topic created in 4034 days ago, the information mentioned may be changed or developed.

    gcc 与 clang 崩得一样,在进 while 时崩。
    而且如果在 while 的第一行加上输出 std::endl 的话会在倒数第二个循环崩掉。。。
    根据我在各处添加的各种输出情况来看,算法逻辑上应该没有错误,红黑树也写对了的。。。
    https://gist.github.com/anonymous/cfdecea6a83baa638d23

    3 replies  •  2015-11-08 20:29:42 +08:00
    linux40
    linux40
    OP
    Nov 8, 2015
    1
    还有 github 的语法高亮很赞啊,有没有什么方法用在编辑器上。。。
    onlyxuyang
    onlyxuyang
    Nov 8, 2015 via Android
    2
    根据你加 std :: endl 的描述来看,可以考虑盖栈了
    linux40
    linux40
    OP
    Nov 8, 2015 via Android
    3
    @onlyxuyang 什么意思啊,我这只用 7 个元素测试的啊。。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2450 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 13:16 · PVG 21:16 · LAX 05:16 · JFK 08:16
    ♥ Do have faith in what you're doing.