Java for IOI 2015

Revision en3, by microtony, 2015-06-18 06:13:42

I maintain a online judge which uses CMS isolate sandbox. I was trying to support Java so I looked at CMS itself, and found that they are using gcj (GNU Compiler for Java) as you can see in this commit.

https://github.com/cms-dev/cms/commit/cf949952424677e0b0762eec5e461e33f85eecb3

Also you can see this blame:

blame

In my server, I have several bugs:

(Of course these bugs are related to I/O and since IOI uses interface file so it may not be a problem.)

public class Task {
  public static void main(String[] args) {
    System.out.format("$%.3f\n", 0.9876);
  }
}
Expected output: $0.988
Program output: $
import java.util.*;
import java.io.*;
public class Task {
  public static void main(String[] args) throws IOException {
    Scanner in = new Scanner(System.in);
    System.out.print((char) System.in.read());
    System.out.println(in.nextInt());
  }
}
Input: A5
Expected Output: A5
Program: 
(strange character)Exception in thread "main" java.util.InputMismatchException: "A5" is not an integer
   at java.util.Scanner.myNextInt(libgcj.so.15)
   at java.util.Scanner.nextInt(libgcj.so.15)
   at java.util.Scanner.nextInt(libgcj.so.15)
   at Task.main(Task.java)
Tags ioi, java

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English microtony 2015-06-21 06:15:24 89 Tiny change: '**Update: ** [user:a' -
en4 English microtony 2015-06-18 17:12:08 689 Tiny change: 'work with Scanner.in.read(). Even if ' - (published)
en3 English microtony 2015-06-18 06:13:42 2 Tiny change: 's blame:\n![blame]' -> 's blame:\n\n![blame]'
en2 English microtony 2015-06-18 06:13:23 113
en1 English microtony 2015-06-18 06:08:38 1354 Initial revision (saved to drafts)