You can just use gcj to compile your java programs before submitting, it should get rid of most of the issues.
The second statement up there is 'true', but it is missunderstood, the issue is that the normal Java was not as easy to block from reading files for the admins as gcj.
JAVA-Difficulties We Face
Moderator: Board moderators
-
- New poster
- Posts: 15
- Joined: Thu Sep 02, 2010 3:10 pm
- Location: Dhaka,Bangladesh
- Contact:
Re: JAVA-Difficulties We Face
I have learned Java a little.Now I am trying to use Java for UVA.I have submitted 100 no.it is runtime error.I think ,it is for Scanner.You please help me take input from standard input ensuring EOF.My code is given below.
Code: Select all
import java.io.*;
import java.util.*;
class Main {
static int cycle(int m)
{
int i = 1;
while (m != 1){
if (m % 2 == 0){
m = m/2;
}
else{
m = 3*m+1;
}
i++;
}
return i;
}
public static void main(String ars[]){
String input;
int a,b,tm,ma,mb,max,i,ttm;
StringTokenizer s;
Scanner k=new Scanner(System.in);
while((input=k.nextLine())!= null)
{
s=new StringTokenizer(input);
a=Integer.parseInt(s.nextToken());
b=Integer.parseInt(s.nextToken());
ma=a;mb=b;
if(a>b)
{
tm=a;
a=b;
b=tm;
}
max=cycle(a);
for(i=a+1;i<=b;i++){
ttm=cycle(i);
if(ttm>max)
{ tm=ttm;
ttm=max;
max=tm;
}
}
System.out.println (ma + " " + mb + " "+max );
}
} //main
}//class