when i compiled my program with bluej on my laptop no compilation error it worked fine but here in code chef it is showing compilation error " inputreader symbol not fount" below i am posting my program:
import java.io.*;
public class t
{
public static void main(String[] args)throws IOException
{
InputStream str = System.in;
InputReader in = new InputReader(str);
int t;
t = in.readInt();
int a[][]=new int[t+1][11];
int i,j;
for(i=0;i<t;i++)
{
for(j=0;j<10;j++)
{
a[i][j]=in.readInt();
}
}
int m,r,s=-1;
int b[]=new int[10];
for(j=0;j<t;j++)
{
s=-1;
for(i=0;i<=10000;i++)
{
m=i;
for(int k=0;k<10;k++)
{
b[k]=0;
}
while(m>0)
{
r=m%10;
m=m/10;
b[r]=b[r]+1;
}
for(int p=0;p<10;p++)
{
if(b[p]!=0)
{
if(b[p]>a[j][p])
{
s=0;
System.out.println(i);
break;
}
}
}
if(s==0)
break;
}
}
}
}
Hello @krranjan3008 ,
At CodeChef , you have to name your class “Main” and nothing else . Otherwise you will get compilation error .
1 Like
… or your class CANNOT be public, see this one for example - http://ww2.codechef.com/viewsolution/812461
@betlista : Class can be public , that is not the problem . I program in Java and have always used public classes at CodeChef .
As far as I can see, you use Main as class name, I just said, that you can use whatever name you want if the class is not public. I really do not like the need of naming class Main, because you cannot have multiple such classes in project/folder.
1 Like
its showing error in inputreader line pls help i am jst a beginner here…
Hello @krranjan3008 , You are using InputReader class , however there is no class in java.io package by that name . The class i think you want to use is InputStreamReader . At least in Java 1.6 there is nothing called InputReader . You should check the version of java , your bluej uses and set it to 1.6 or 1.6.0.12 which is the one codechef uses . You may have to download that version of jdk and jre . Also as I said you will have to change the name of your class from ‘t’ to ‘Main’ . Otherwise you will still get compilation error .
1 Like
As I wrote here - http://discuss.ww2.codechef.com/questions/9189/error-message . Maybe he is using his class named InputReader.
When you writing about class naming, please write both possibilities, not just the one you prefer/are using.