V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
linux40
V2EX  ›  C

为什么我写的 josephus 会崩?

  •  1
     
  •   linux40 · Nov 8, 2015 · 1316 views
    This topic created in 3823 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
        1
    linux40  
    OP
       Nov 8, 2015
    还有 github 的语法高亮很赞啊,有没有什么方法用在编辑器上。。。
    onlyxuyang
        2
    onlyxuyang  
       Nov 8, 2015 via Android
    根据你加 std :: endl 的描述来看,可以考虑盖栈了
    linux40
        3
    linux40  
    OP
       Nov 8, 2015 via Android
    @onlyxuyang 什么意思啊,我这只用 7 个元素测试的啊。。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4464 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 01:00 · PVG 09:00 · LAX 18:00 · JFK 21:00
    ♥ Do have faith in what you're doing.