Can anyone please tell me what's wrong with this code? It's showing *RE *at
the *Test Set 2*.
import java.util.Scanner;
import static java.lang.Math.max;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int tt, n, i, index, ans = 0;
int[] x = new int[100];
n = scan.nextInt();
for (tt = 1; tt <= n; tt++) {
ans = 0;
index = scan.nextInt();
for (int j = 1; j <= index; j++) {
x[j] = scan.nextInt();
}
for (int jj = 1; jj <= index; jj++) {
int min = x[jj];
int maxn = x[jj];
while (maxn <= x[jj - 1]) {
maxn = maxn * 10 + 9;
min = min * 10 + 0;
ans++;
}
x[jj] = max(x[jj - 1] + 1, min);
}
System.out.println("Case #" + tt + ": " + ans);
}
}
}
--
-- You received this message because you are subscribed to the Google Groups
Code Jam group. To post to this group, send email to
[email protected]. To unsubscribe from this group, send email to
[email protected]. For more options, visit this group at
https://groups.google.com/d/forum/google-code?hl=en
---
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/ad485df3-94ac-4c5d-a277-4fe3e503f657n%40googlegroups.com.