Today I tried to submit answers to Columbus weekend Contest #4, but could not pass the "compile error".
Even when I did not include any external libraries. The judges still returned me "Compile error".
Here's my code:
Code: Select all
class Main {
static String readLine() throws Exception
{
char c=' ';
String str="";
while (true)
{
c=(char) System.in.read();
if (c=='\n') break;
str+=c;
}
return str;
}
public static void main(String args[]) throws Exception
{
String str=readLine();
String[] arr= str.split(" ");
int n= Integer.parseInt(arr[0]);
double t= Double.parseDouble(arr[1]);
System.out.printf("Program 1 by team 11568\n");
while (true)
{
str= readLine();
arr= str.trim().split(" ");
int a= Integer.parseInt(arr[0]);
int b= Integer.parseInt(arr[1]);
int c= a-b;
if (c<0) c+=n;
double r= ((float)c-0.5)/(float)(n-1)*t;
System.out.printf("Chair %3d meets chair %3d, remaining time = %5.1f\n",a,b,r);
}
}
}
i feel desperate.. Any help will be really appreciated!
Thank u in advance.