no errors in ideone, not sure what is causing the error.
import java.util.;
import java.io.;
public class Main {
public static int reverse(int z) {
String q = Integer.toString(z);
String rev = “”;
for(int h=1;h<=q.length();h++) {
int div=10;
div=(int) Math.pow(div, h);
rev+=Integer.toString((z%div)/(div/10));
}
z=Integer.parseInt(rev);
return z;
}
public static void main(String[] args) throws java.lang.Exception {
ArrayListnums = new ArrayList();
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
String x=input.readLine();
int K=1000000;
int y;
for(int i=0;i<Integer.parseInt(x);i++) {
y=Integer.parseInt(input.readLine());
for(int j=0;j<K;j++) {
int c= y+j;
if(c==reverse©) {
nums.add©;
break;
}
}
}
System.out.println(nums);
}
}
created
last reply
- 3
replies
- 569
views
- 2
users
- 2
links