当我们书写代码进行条件判断时,常会书写出以下类似的代码: def foo(num):if num ==11:do_something()if num ==22:do_otherthing() 但是有没有想过,当我们把代码提交给别人时,如何做到让其他人能够快速准确的知道11,22这些数值面值代表的意思呢? 1.最直接的方式在数值面值处添加注释,但这显然不是提升代码可读性的最佳方式 2.采用枚
这些是我写代码时的一些经验,总结了一下分想给大家,没啥顺序,想到就写上了 1.使用局部变量避免使用全局变量 比如 function test(){ var s = document.getElementById('aaa'); s.innerHTML = document.body.clientHeight;
B. Chips http://codeforces.com/problemset/problem/333/B time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Gerald play