Introduction Judging websites n n UVa online judge
Introduction
Judging websites n n UVa online judge The Programming Challenges judge
UVa Online Judge n 收集歷年ACM程式設計競賽 n n n n ACM International Collegiate Programming Contest (ICPC) 1977 ~ 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
n http: //online-judge. uva. es/problemset/ n n 提供題目可供線上測試結果 Register: http: //acm. uva. es/problemset/registerjudge. php
The programming Challenges Judge n http: //www. programming-challenges. com/
Problem set volumes n 題庫分二部份 n n Volume I ~ Volume IX : 100 ~ 999 Volume C ~ Volume CX : 10000 ~ 11099 依照右邊比例來判別難易度 題目的中譯及難易度分類網站 http: //www 2. dmhs. kh. edu. tw/
How to submit programs n n via web: http: //acm. uva. es/problemset/registerjudge. php via email
Submitted by email /* @JUDGE_ID: 1000 AA 100 C "Dynamic Programming" */ /* @BEGIN_OF_SOURCE_CODE */ your program here /* @END_OF_SOURCE_CODE */ language your user ID Problem number
Example: 3 n + 1 n PC/UVa IDs: 110101/100, Popularity: A, Success rate: low, Level: 1
Feedback From the Judge n Accepted (AC) n n Presentation Error (PE) n n 系統使用的是Linux gcc compiler Runtime Error (RE) n n 對某些test cases, 有不正確的答案 Compile Error (CE) n n 原則上成功, 輸出格式有小誤差, 多一個空白或空格 Wrong Answer (WA) n n 成功 執行發生錯誤, segmentation fault, floating point exception Time Limit Exceeded (TL) n 十秒內沒有執行結束
n Memory Limit Exceeded (ML) n n Output Limit Exceeded (OL) n n 輸出結果太大, maybe infinite loop Restricted Function (RF) n n memory使用超過系統限制 illegal system function, fork(), fopen() Submission Error (SE) n incorrect user ID, problem number
Language n C, C++, Pascal, Java
C language n Parameter Passing n n Data types n n int, float, char, long, double Arrays n n call-by-value range from 0 to n – 1 Operators n %, &&, ||
Standard Input/Output n Read the test data from the standard Input and print the results to the standard output
Submit Java program n n n 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 n Write the comments first n n Document each variable n n 為每個變數寫說明 Use symbolic constants n n 方便以後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; …
n n n Use subroutine to avoid redundant code Make your debugging statements meaningful object-oriented programming n n 很適合用於建立大或重用率高的程式 programming challenge大都短且技巧性題 目
Case study: 3 n + 1 n n http: //online-judge. uva. es/p/v 1/100. html http: //www 2. dmhs. kh. edu. tw/homework/q 100. htm Algebra problem The problem remains open to this day
Minesweeper n n PC/UVa IDs: 110102/10189, Popularity: A, Success rate: high Level: 1 http: //online-judge. uva. es/p/v 101/10189. html The Minesweeper consistency problem : NP-complete Clay Institute of Mathematics: $1, 000
The Trip n n n PC/UVa IDs: 110103/10137, Popularity: B, Success rate: average Level: 1 Problem A: The Trip Optimization problem
LCD Display n n PC/UVa IDs: 110104/706, Popularity: A, Success rate: average, Level: 1 http: //online-judge. uva. es/p/v 7/706. html
Graphical Editor n n n PC/UVa IDs: 110105/10267, Popularity: B, Success rate: low, Level: 1 http: //online-judge. uva. es/p/v 102/10267. html Simulation and Modelling
- Slides: 44