Giter Site home page Giter Site logo

aoapc-bac2nd-keys's Issues

195页例题7-5有一处笔误

第二段:

输入正整数n和L,输出由前L个字符组成的、字典序第k小的困难的串。

应该是字典序第n小的困难的串。

另外,书上的样例输出与题目实际要求的输出出入较大,是不是因为希望读者去读原题所以才这样?

《习题与解答》P11 & P12 & P19,20 & P25 疑问

P11
从上往下
vector<string> vec{1,2,3};
应改成
vector<string> vec{"1","2","3"};

P12
在HashFunc中,蒟蒻有些不清楚
return (hash<int>()(o.x) ^ hash<string>()(o.y) << 1) >> 1;
这一句最后的">>1"的作用.
假如值在先前的运算中已经一样的话,右移等于没效果.
假如值不一样,这样反而有极小的概率使得其相同,就Hash冲突了.
好像只会浪费时间诶,应该可以去掉吧.

182页 UVa725的讲解中对枚举量的分析有误

紫书182页,UVa725,分析里面说枚举量降低到不到1万,这个不对,应该说枚举量的数量级降低到一万。做一下实验发现,枚举量最大的时候是n=2,示例代码中fghij从1234枚举到50000。

紫书的两个小问题

  • 紫书例题9-22(UVA12105)的参考程序好像有点小问题?
    对于Udebug给出的数据并不能通过全部样例,在形如12 1593之类的只有0满足条件的数据的时候,程序会输出两个0。(虽然UVA上可以AC)
    (在程序中加入特判多个零出现的情况就好了)

  • 紫书习题8-7 书上的翻译和实际问题不符
    书上的问题:用不超过2n^2次操作把它变成升序;
    实际问题:用不超过2n^2次操作把升序变成它

代码改进

ch4/UVa1589.cc
第118行应修改为:
scanf(" %c%d%d", &type, &(p.x), &(p.y));

原答案未在%c前添加空格,不添加空格时上一次输入的回车存在于缓冲区中,导致type读取为'\n'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.