fork download
  1. object Main extends App {
  2. val inf = 1e7.toInt
  3.  
  4. def m(eggs: Int, floors: Int): Int = {
  5. val memo = Array.ofDim[Int](eggs+1, floors+1)
  6. for (f <- 2 to floors) memo(0)(f) = inf
  7. for (e <- 0 to eggs) {
  8. memo(e)(0) = 0
  9. memo(e)(1) = 0
  10. }
  11. for (e <- 1 to eggs; j <- 2 to floors) {
  12. memo(e)(f) = inf
  13. for (i <- 0 to floors - 1) {
  14. import scala.math.min
  15. memo(e)(f) = min(memo(e)(f), memo(e-1)(i+1))
  16. memo(e)(f) = min(memo(e)(f), memo(e)(f-i-1))
  17. }
  18. }
  19.  
  20. memo(e)(f)
  21. }
  22.  
  23. print(m(2, 100))
  24. }
  25.  
  26.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.scala:12: error: not found: value f
			memo(e)(f) = inf
                                ^
Main.scala:15: error: not found: value f
				memo(e)(f) = min(memo(e)(f), memo(e-1)(i+1))
                                        ^
Main.scala:15: error: not found: value f
				memo(e)(f) = min(memo(e)(f), memo(e-1)(i+1))
                                                         ^
Main.scala:16: error: not found: value f
				memo(e)(f) = min(memo(e)(f), memo(e)(f-i-1))
                                        ^
Main.scala:16: error: not found: value f
				memo(e)(f) = min(memo(e)(f), memo(e)(f-i-1))
                                                         ^
Main.scala:16: error: not found: value f
				memo(e)(f) = min(memo(e)(f), memo(e)(f-i-1))
                                                                     ^
Main.scala:20: error: not found: value e
		memo(e)(f)
                     ^
Main.scala:20: error: not found: value f
		memo(e)(f)
                        ^
8 errors found
Usage: scalac <options> <source files>
where possible standard options include:
  -Dproperty=value                Pass -Dproperty=value directly to the runtime system.
  -J<flag>                        Pass <flag> directly to the runtime system.
  -P:<plugin>:<opt>               Pass an option to a plugin
  -X                              Print a synopsis of advanced options.
  -bootclasspath <path>           Override location of bootstrap class files.
  -classpath <path>               Specify where to find user class files.
  -d <directory|jar>              destination for generated classfiles.
  -dependencyfile <file>          Set dependency tracking file.
  -deprecation                    Emit warning and location for usages of deprecated APIs.
  -encoding <encoding>            Specify character encoding used by source files.
  -explaintypes                   Explain type errors in more detail.
  -extdirs <path>                 Override location of installed extensions.
  -feature                        Emit warning and location for usages of features that should be imported explicitly.
  -g:<level>                      Set level of generated debugging info. (none,source,line,vars,notailcalls) default:vars
  -help                           Print a synopsis of standard options
  -javabootclasspath <path>       Override java boot classpath.
  -javaextdirs <path>             Override java extdirs classpath.
  -language:<_,feature,-feature>  Enable or disable language features: `_' for all, `-language:help' to list
  -no-specialization              Ignore @specialize annotations.
  -nobootcp                       Do not use the boot classpath for the scala jars.
  -nowarn                         Generate no warnings.
  -optimise                       Generates faster bytecode by applying optimisations to the program
  -print                          Print program with Scala-specific features removed.
  -sourcepath <path>              Specify location(s) of source files.
  -target:<target>                Target platform for object files. All JVM 1.5 targets are deprecated. (jvm-1.5,jvm-1.6,jvm-1.7,jvm-1.8) default:jvm-1.6
  -toolcp <path>                  Add to the runner classpath.
  -unchecked                      Enable additional warnings where generated code depends on assumptions.
  -uniqid                         Uniquely tag all identifiers in debugging output.
  -usejavacp                      Utilize the java.class.path in classpath resolution.
  -usemanifestcp                  Utilize the manifest in classpath resolution.
  -verbose                        Output messages about what the compiler is doing.
  -version                        Print product version and exit.
  @<file>                         A text file containing compiler arguments (options and source files)

spoj: The program compiled successfully, but Main.class was not found.
      Class Main should contain method: def main(args: Array[String]).
stdout
Standard output is empty