oj注意事项

本文提供了一系列编程建议,包括避免在提交代码前忘记删除测试代码、仔细阅读模糊不清的问题陈述、不盲目追求时间效率和内存成本等。通过使用回溯而非暴力搜索,即使算法复杂度较高,也能在限定时间内获得正确答案,同时提醒注意UVA的O2开关对编译代码的影响。

Couple things to remember:

  1. Remove all the test codes before submit it. This sounds silly but I've done it couple of times.
  2. Read the problem statement carefully, as some of them are vague intentionally. e.g. In the poker hands one, it doesn't say duplicate cards are not valid.
  3. Don't worry too much about the time efficiency and memory cost. If the algorithm is right (using backtracking instead of brute-forcing), you will have an answer within the time limit (3 sec). The memory limit is usually quite large, as long as you are not running into a dead loop and forcing the computer to malloc a gigantic array every time, it's fine. This is not an optimization competition, so too much thinking about that could be real harm. (Not to mention UVA has the O2 flag on when compiling the code.)

转载于:https://www.cnblogs.com/jocobHerbertPage/archive/2011/08/23/2150501.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值