Permalink
Browse files

Remove useless code

  • Loading branch information...
1 parent 85a65a5 commit a68d4a6a1326554739a315dd30b5524197e421bb @xieweiking committed Oct 20, 2012
Showing with 4 additions and 14 deletions.
  1. +1 −1 src/common/Problem.scala
  2. +3 −13 src/main/Main.scala
View
@@ -15,7 +15,7 @@ trait Problem extends App {
i += 1
try {
val answer = Class.forName(prefix + i)
- val arg = Array[String]()
+ val arg = Array.empty[String]
println
answer.getMethod("main", arg.getClass).invoke(answer, arg)
println
View
@@ -2,24 +2,14 @@ package main
object Main extends App {
- private def toThreeDigitStr(index: Int) = {
- var str = index.toString
- val len = str.length
- if (len == 1)
- "00" + str
- else if (len == 2)
- "0" + str
- else
- str
- }
-
var more = true
var i = 0
- val arg = Array[String]()
+ val arg = Array.empty[String]
do {
i += 1
try {
- val problem = Class.forName(String.format("problem_%s.package", toThreeDigitStr(i)))
+ val clazzName = "problem_%03d.package".format(i)
+ val problem = Class.forName(clazzName)
if (i > 1) println("\n\n")
problem.getMethod("main", arg.getClass).invoke(problem, arg)
}

0 comments on commit a68d4a6

Please sign in to comment.