Four simple problems are described in the following PDF document:
This sample problem set is the practice problem set used at the 2010 SER USA programming competition.
The Unix shell script (Bourne Shell) testPrograms.sh conveniently downloads, compiles, and tests all languages on all the test data for each of the three problems. (Naturally, each of the GNU/Linux compilers must be installed in order for the script to work on that language.)
Language | A: Which is Greater? | B: Rectangle Area | C: Count the Vowels |
---|---|---|---|
Ada | great.adb | area.adb | count.adb |
C | great.c | area.c | count.c |
C++ | great.cpp | area.cpp | count.cpp |
C# | Great.cs | Area.cs | Count.cs |
Fortran | great.f95 | area.f95 | count.f95 |
Go | great.go | area.go | count.go |
Haskell | great.hs | area.hs | count.hs |
Java 7 | Great.java | Area.java | Count.java |
Java 8 | Great.java | Area.java | Count.java |
Lua | great.lua | area.lua | count.lua |
Pascal | great.pas | area.pas | count.pas |
Python 2 | great.py | area.py | count.py |
Python 3 | great.py3 | area.py3 | count.py3 |
Scala | Great.scala | Area.scala | Count.scala |
The details about compiling and running each of the problems follows. Note that most of the options are irrelevant from the perspective of program development. Exceptions are -lm for gcc and the runtime options for Java. [What about Haskell?]
In some languages it is possible to write source code in such a way as to prevent compilation or to cause runtime errors which manifest themselves only in the judging environment and not in the contest development environment. Since no such extreme techniques are necessary to create legitimate solutions, using environmentally sensitive source code should be avoided.
Language | Program | compile | execute |
---|---|---|---|
Ada | great.adb | gnatmake -static -Wall -O2 -o great great.adb -bargs -static | ./great < great-000.inp > great-000.out |
C | great.c | gcc -static -Wall -O2 -o great great.c -lm | ./great < great-000.inp > great-000.out |
C++ | great.cpp | g++ -static -Wall -O2 -o great great.cpp | ./great < great-000.inp > great-000.out |
C# | Great.cs | gmcs -out:great.exe Great.cs | ./great.exe < great-000.inp > great-000.out |
Fortran95 | great.f95 | g++ -static -Wall -O2 -o great great.f95 | ./great < great-000.inp > great-000.out |
Haskell | great.hs | ghc -static -optl-pthread -Wall -O2 -o great great.hs | ./great < great-000.inp > great-000.out |
Java | Great.java | javac Great.java | java -Xrs -Xss8m -Xms256m Great < great-000.inp > great-000.out |
Pascal | great.pas | fpc -wiwn -O2 -Sg -XS -ogreat great.pas | ./great < great-000.inp > great-000.out |
Python | great.py | (do nothing) | python great.py < great-000.inp > great-000.out |
Scala | great.scala | scalac great.scala | scala great < great-000.inp > great-000.out |
Language | Program | compile | execute |
---|---|---|---|
Ada | area.adb | gnatmake -static -Wall -O2 area area.adb -bargs -static | ./area < area-000.inp > area-000.out |
C | area.c | gcc -static -Wall -O2 -o area area.c -lm | ./area < area-000.inp > area-000.out |
C++ | area.cpp | g++ -static -Wall -O2 -o area area.cpp | ./area < area-000.inp > area-000.out |
C# | Area.cs | gmcs -out:area.exe Area.cs | ./area.exe < area-000.inp > area-000.out |
Fortran95 | area.f95 | g++ -static -Wall -O2 -o area area.f95 | ./area < area-000.inp > area-000.out |
Haskell | area.hs | ghc -Wall -O2 -o area area.hs | ./area < area-000.inp > area-000.out |
Java | Area.java | javac Area.java | java -Xrs -Xss8m -Xms256m Area < area-000.inp > area-000.out |
Pascal | area.pas | fpc -viwn -O2 -Sg -XS -oarea area.pas | ./area < area-000.inp > area-000.out |
Python | area.py | (do nothing) | python area.py < area-000.inp > area-000.out |
Language | Program | compile | execute |
---|---|---|---|
Ada | count.adb | gnatmake -static -Wall -O2 -o count count.adb -bargs -static | ./count < count-000.inp > count-000.out |
C | count.c | gcc -static -Wall -O2 -o count count.c -lm | ./count < count-000.inp > count-000.out |
C++ | count.cpp | g++ -static -Wall -O2 -o count count.cpp | ./count < count-000.inp > count-000.out |
C# | Count.cs | gmcs -out:count.exe Count.cs | ./count.exe < count-000.inp > count-000.out |
Fortran95 | count.f95 | g++ -static -Wall -O2 -o count count.f95 | ./count < count-000.inp > count-000.out |
Haskell | count.hs | ghc -static -optl-pthres -Wall -O2 -o count count.hs | ./count < count-000.inp > count-000.out |
Java | Count.java | javac Count.java | java -Xrs -Xss8m -Xms256m Count < count-000.inp > count-000.out |
Pascal | count.pas | fpc -viwn -O2 -Sg -XS -ocount count.pas | ./count < count-000.inp > count-000.out |
Python | count.py | (do nothing) | python count.py < count-000.inp > count-000.out |