Introduction

Download Report

Transcript Introduction

Introduction
Judging websites


UVa online judge
The Programming Challenges judge
UVa Online Judge

收集歷年ACM程式設計競賽







ACM International Collegiate Programming Contest (ICPC)
1977 ~ 2006
2006: 5606 3-person teams, 1737 universities in 84
countries (台大19)
Each team is composed of 3 students
5 ~ 10 programming problems
Only one computer is allocated
typically about five hours

http://online-judge.uva.es/problemset/


提供題目可供線上測試結果
Register:
http://acm.uva.es/problemset/registerjudge.php
The programming Challenges
Judge

http://www.programming-challenges.com/
Problem set volumes

題庫分二部份




Volume I ~ Volume IX : 100 ~ 999
Volume C ~ Volume CX : 10000 ~ 11099
依照右邊比例來判別難易度
題目的中譯及難易度分類網站
http://www2.dmhs.kh.edu.tw/
How to submit programs


via web:
http://acm.uva.es/problemset/registerjudge.php
via email
Submitted by email
/* @JUDGE_ID: 1000AA 100 C "Dynamic Programming" */
/* @BEGIN_OF_SOURCE_CODE */
your program here
/* @END_OF_SOURCE_CODE */
language
your user ID
Problem number
Example: 3n + 1

PC/UVa IDs: 110101/100, Popularity: A,
Success rate: low, Level: 1
Feedback From the Judge

Accepted (AC)


Presentation Error (PE)


系統使用的是Linux gcc compiler
Runtime Error (RE)


對某些test cases, 有不正確的答案
Compile Error (CE)


原則上成功, 輸出格式有小誤差, 多一個空白或空格
Wrong Answer (WA)


成功
執行發生錯誤, segmentation fault, floating point exception
Time Limit Exceeded (TL)

十秒內沒有執行結束

Memory Limit Exceeded (ML)


Output Limit Exceeded (OL)


輸出結果太大, maybe infinite loop
Restricted Function (RF)


memory使用超過系統限制
illegal system function, fork(), fopen()
Submission Error (SE)

incorrect user ID, problem number
Language

C, C++, Pascal, Java
C language

Parameter Passing


Data types


int, float, char, long, double
Arrays


call-by-value
range from 0 to n – 1
Operators

%, &&, ||
Standard Input/Output

Read the test data from the standard
Input and print the results to the
standard output
Submit Java program





gcj compiler
java::io use is restricted
Network functions and threads are
unavailable
math, util, common packages are
authorized
Begin in static main method
Programming Hints

Write the comments first


Document each variable


為每個變數寫說明
Use symbolic constants


方便以後debug
在程式前方為常數宣告變數
Use enumerated types for a reason
switch(cursuit) {
case 'C' :
newcard.suit = C;
break;
case 'D' :
newcard.suit = D;
break;
case 'H' :
newcard.suit = H;
break;
case 'S' :
newcard.suit = S;
…



Use subroutine to avoid redundant code
Make your debugging statements
meaningful
object-oriented programming


很適合用於建立大或重用率高的程式
programming challenge大都短且技巧性題
目
Case study: 3n + 1




http://online-judge.uva.es/p/v1/100.html
http://www2.dmhs.kh.edu.tw/homework/q100.htm
Algebra problem
The problem remains open to this day
Minesweeper




PC/UVa IDs: 110102/10189, Popularity:
A, Success rate: high Level: 1
http://online-judge.uva.es/p/v101/10189.html
The Minesweeper consistency problem : NP-complete
Clay Institute of Mathematics: $1,000,000
The Trip



PC/UVa IDs: 110103/10137, Popularity:
B, Success rate: average Level: 1
Problem A: The Trip
Optimization problem
LCD Display


PC/UVa IDs: 110104/706, Popularity: A,
Success rate: average, Level: 1
http://online-judge.uva.es/p/v7/706.html
Graphical Editor



PC/UVa IDs: 110105/10267, Popularity: B,
Success rate: low, Level: 1
http://online-judge.uva.es/p/v102/10267.html
Simulation and Modelling