Java Support in the Judge

Write here if you have problems with your Java source code

Moderator: Board moderators

Post Reply
judge
System administrator
Posts: 8
Joined: Sun Oct 07, 2001 2:00 am
Contact:

Java Support in the Judge

Post by judge » Tue Apr 30, 2002 12:52 pm

If you haven't done it yet, please review this web pages related to Java in the judge:

http://acm.uva.es/problemset/java.html
http://acm.uva.es/problemset/howtows.html#java
http://acm.uva.es/problemset/data/p100.java.html

Best regards,

Fernando N

vincehung
New poster
Posts: 2
Joined: Tue Feb 05, 2002 2:00 am
Contact:

the example code doesn't even work ...

Post by vincehung » Sat May 18, 2002 10:42 pm

the example code doesn't even work ...
it still gets compile error ....
i tried tons of times .....
:cry: [/java]

EZE
New poster
Posts: 4
Joined: Wed Nov 06, 2002 2:34 am

Solution...

Post by EZE » Wed Nov 06, 2002 9:16 am

I couldnt get the java mail submission to work, but if you submit using the online form on the web site it works fine. The only problem is that the big number class and other such usefull java classes (they're the only reason I would use java :P) dont seem to be on the servers.

ciao
EZE

mythicwolf
New poster
Posts: 2
Joined: Thu Jan 27, 2005 8:25 am

Post by mythicwolf » Thu Jan 27, 2005 8:29 am

i think the reason the sample code doesn't work is because the judge doesnt allow use of the java.util package and the code uses it

chy168
New poster
Posts: 1
Joined: Thu May 05, 2005 9:51 am

Post by chy168 » Thu May 05, 2005 9:53 am

Hi, I can not download the sample code.

Thank you~ ^^

uviedor
New poster
Posts: 1
Joined: Thu Jun 16, 2005 7:08 am

You don't have permission to access /p/data/p100.java.html o

Post by uviedor » Sun Jun 19, 2005 5:52 am

Hello,

I have intend view the code from: http://acm.uva.es/p/data/p100.java.html and not it is disponible. Please help me. I need this code.

Excuse my english. I am speaking spanish. I am venzuelan.

Stefan_Bialucha
New poster
Posts: 5
Joined: Mon Mar 31, 2008 12:49 am

Re: Java Support in the Judge

Post by Stefan_Bialucha » Sun Mar 27, 2011 2:57 am

Because there is some lack of up to date information about sending in solutions in Java:
You can use this code frame as a start:

Code: Select all

import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        new Main().solveProblem();
    }
    public void solveProblem() {
        final Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int input = scanner.nextInt();
            int solution = solveCase(input);
            System.out.println(solution);
        }
        scanner.close();
    }
    public int solveCase(int number)
    {
        int solution = number + number;
        return solution;
    }
}

Janijan
New poster
Posts: 1
Joined: Wed Dec 28, 2011 1:01 pm

Re: Java Support in the Judge

Post by Janijan » Wed Dec 28, 2011 1:30 pm

hi,

i'm trying to solve the problem 10055 - Hashmat the Brave Warrior, i have the next code, this code is running fine in my eclipse , but when i submit the code to the judge, they answer me:

"Your submission with number 9597827 for the problem 10055 - Hashmat the Brave Warrior has failed with verdict Runtime error.
This means that the execution of your program didn't finish properly. Remember to always terminate your code with the exit code 0."

is this problem recomended to make in java to submit to the judged? i'm a begginner, please help me with any information about how i can modify this code to submit in java?

The Code:

import java.util.Scanner;

class TheBraveWarrior {
public static void main(String[] args){

new TheBraveWarrior().solveProblem();

}

void solveProblem(){
Scanner in=new Scanner(System.in);
long num=0,num2=0;

while(num <= Math.pow(2, 32) && num2 <= Math.pow(2, 32)){

num=in.nextLong();
num2=in.nextLong();
printLine(num,num2);

if(in.hasNext("0"))break;
}
in.close();
}

void printLine(long num,long num2){
long res=0;
if(num>num2)
res=num-num2;
else
res=num2-num;

System.out.println(res);
}
}

Thanks for your attention.

Post Reply

Return to “Java”