POJ介绍

前言

一直觉得自己的编程能力还很有欠缺,(实际上英语也不行),这里想从ACM编程题入手,每天编一编程序,并希望自己能够坚持。

POJ简介

POJ,全称“北京大学程序在线评测系统”(Peking University Online Judge)

“北京大学程序在线评测系统”是一个免费的公益性网上程序设计题库,它包含3000多道饶有趣味的程序设计题,题目大部分来自ACM国际大学生程序设计竞赛和各种自行举办比赛的题目,很多题目就反映工作和生活中的实际问题。用户可以针对某个题目编写程序并提交,让POJ自动判定程序的对错,几秒之内即可知道对还是错。作为教学支持,每个学生在POJ上可以建立自己的账号,教师在POJ上一眼就能看到布置的习题学生是否已经完成,这几乎将教师评判学生作业的工作量减少到零。POJ对于程序的正确性评判是极为严格的,不仅逻辑要对,而且数据的格式也要对。这对于培养严谨、周密的程序设计作风极为有效,学生必须考虑到每一个细节和特殊边界条件,而不是大体上正确就能通过。传统的人工评判是难以做到这一点的。 [1] [2]

如何使用POJ

1)访问POJ主页:http://poj.org/

2)先仔细阅读Frequently Asked Questions版块,熟悉基本规则、流程:

Q: Where does my program input from and output to?
A: Your program should always input from stdin (standard input) and output to stdout (standard output). For example, you can use scanf in C or cin in C++ to read, and printf in C or cout in C++ to write. User programs are NOT allowed to open and read from/write to any file. You will probably get responded with Runtime Error or Wrong Answer if you try to do so.
More should be noted about I/O operations in C++. Due to their complex underlying implementation models, cin and cout are comparatively slower than scanf and printf. The difference in performance is shown by many experiences to be more significant if the program is compiled by G++. Therefore if a problem has huge input, using cin and cout will possibly lead to Time Limit Exceed.

意思就是程序的输入输出必须是“标准输入,输出”,比如,C用scanf,printf,C++用cin,cout
要注意的是:cin,cout比scanf,printf要慢一些。所以,如果一个问题有很大/多的输入,那么使用cin和cout可能会导致“超时”错误。


Q: What are the compilers provided by the judge?
A: Currently five compilers are provided for six language options. For C and C++, MS-VC++ 6.0 is used. For GCC/G++, MinGW GCC/G++ 3.4.2 is used. For Pascal, FreePascal 2.0.0 is used. For Java, JDK 1.5.0 is used.

C,C++,GCC,G++,Pascal,Java都支持。


Q: How is my program judged?
A: The judge first saves your submitted program to a file then tries to compile with the compiler corresponding to your selected language option. If compilation fails, Compile Error is returned. The judge then runs your program, feeds the input data to it through the handle to its standard input and does the timing at the same time. Input data are stored in one or more files. Each file is used for judging your program exactly once. During the execution, if the judge finds that your program’s running state meet the criteria for Runtime Error, Time Limit Exceed, Memory Limit Exceed or Output Limit Exceed, the result is immediately returned. No further judging will be done. This implies that in the cases of TLE or MLE, it cannot be told whether your program will eventually produce all correct answers given sufficient resources. When your program finishes one input file and produces some output which is saved to an output file, the judge compares the output file against the file containing the corresponding expected output or uses a special judge program to check the output. If the output is incorrect and does not meet the criteria for Presentation Error, Wrong Answer is returned. Otherwise the judge will run your program again to deal with the next input file. After finishing all input files, if your program has avoided the appearance of all six results mentioned above but produced some output that meets the criteria for Presentation Error, this result is returned. Otherwise Accepted is returned.

打分标准,详细说了各种报错的原因,感觉还挺详细、挺有意思的。



Q: My program exceeds the time limit by just 15MS. How can I improve it?
A: In most cases your program actually requires much more time than the time limit. The judge kills the process instantiating your program once the time limit is exceeded. Usually this occurs 15MS after the limit is exceeded. Common skills in code improvement include reducing constant factor and using efficient algorithms.

怎么减少运行时间:改进代码(比如减少常数因子,使用有效算法)

3)阅读完Frequently Asked Questions之后,打开编程问题界面http://poj.org/problemlist,即可浏览题目,开始编程(当然,需要注册一下,不过是小事啦)。

参考文献

[1] POJ. https://baike.baidu.com/item/POJ
[2] ACM 各大OJ平台以及题目分类. https://blog.csdn.net/dl962454/article/details/73277396

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值