|
|
back to boardWhy Crash#6, Help me please! package Oct_24; import java.io.IOException; import java.io.InputStreamReader; public class T_1769 { public static void main(String[] args) throws IOException { InputStreamReader is = new InputStreamReader(System.in); char c[] = new char[(int) 4e+5 + 1]; int k = 0; c[k] = (char)is.read(); while(is.ready()){ k++; c[k] = (char) is.read(); } k--; int t = 0; int [] a = new int [100001]; for (int i = 1; i <=4; i++) { for (int j = 0; j+i <= k; j++) { String s = (new String(c,j,i)); a[t] = Integer.parseInt(s); t++; } } boolean f[] = new boolean [400001]; for (int i = 0; i < t; i++) { f[a[i]]= true; } for (int i = 1; i < f.length; i++) { if(!f[i]){ System.out.println(i); return; } } } } Edited by author 24.10.2011 19:29 Edited by author 24.10.2011 19:29 |
|
|