dheeraj1995's blog

By dheeraj1995, 10 years ago, In English

while on submitting program i get
Source should satisfy regex [^{}]*public\s+(final)?\s*class\s+(\w+).* please help me to get out of this error here is my program for quest. 227B contest round#140 div 2 import java.io.*; import java.util.*; class IputReader { private int curchar; private int numchar; private byte[] buf = new byte[1024]; private InputStream stream; public IputReader(InputStream stream) { this.stream = stream; } public int read() throws IOException { if(curchar>=numchar) { curchar=0; numchar = stream.read(buf); if(numchar<=0) return -1; } return buf[curchar++]; } public int nextInt() throws IOException { int c = read(); while(isSpaceChar(c)) c = read(); int sgn=1; /* if(c=='-') { sgn=-1; c = read(); } */int res = 0; do{ res *= 10; res += c&15; c = read(); }while(!isSpaceChar(c)); return res*sgn; } public static boolean isSpaceChar(int c) { return c==' '|| c=='\n' || c=='\t' || c=='\r' || c==-1; } } public class approach { public static void main(String args[])throws IOException { IputReader br = new IputReader(System.in); PrintWriter pr=new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); int k; System.out.println("enter:"); int n=br.nextInt(); ArrayList ob=new ArrayList(); //StringTokenizer input=new StringTokenizer(br.readLine()); for(int i=0;i<n;i++) { k=br.nextInt(); ob.add(k); } int m=br.nextInt(); int a=0; int b=0; //input=new StringTokenizer(br.readLine()); for(int i=0;i<m;i++) {

k=br.nextInt();
        int pos=ob.indexOf(k);
        a+=pos+1;
        b+=n-pos;
    }
    System.out.println(a+" "+b);
}

}

Full text and comments »

  • Vote: I like it
  • -6
  • Vote: I do not like it