随笔分类 - 基础的注意问题
摘要:unordered_map是基于哈希表实现的,而map基于红黑树实现 unordered_map在大量数据之下用时常常是比map更少的。 但当我们需要一个有序的关联容器的时候,我们必须选择map
阅读全文
摘要:刚才做题准备表示一下2的x次方,于是就用的long long r=1<<x,但是这里就出现了一个问题,1的值被默认成了一个int型,如果x过大,1<<x就超过int范围, 这时候需要把1转为为long long ,所以就应该是long long r=(long long)1<<x
阅读全文
摘要:单词数 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 55351 Accepted Submission(s): 13839 Problem D
阅读全文
摘要:在用scanf一个一个读入字符的时候 常常会需要防止空格和回车的读入。广泛使用的有三种解决方法。 1.scanf("%c\n",&ch) 在scanf里 \n 很特别的,不是要求输入一个回车换行 引用一下别人的说法: 过滤空格、制表符、回车等输入,也就是说 scanf(“%c\n”, &i); pr
阅读全文
摘要:Complete the ternary calculation.Input There are multiple test cases. The first line of input contains an integer T indicating the number of test case
阅读全文
摘要:For security issues, Marjar University has an access control system for each dormitory building.The system requires the students to use their personal
阅读全文
摘要:对于大量的数据,用cin进行输入往往会超时,除了换成scanf之外,我们还可以在函数内加一句 std::ios::sync_with_stdio(false); 就可以减少时间消耗,达到和scanf差不多的时间,但这个输入之后 就不能混用 scanf cin 参考资料: http://www.cnb
阅读全文