Hello , please let me know for which test case it is falling
Solution: 46363012 | CodeChef
https://www.codechef.com/viewsolution/46363012
My Algorithm:-
1)Nodecount Map contains the number of nodes under this
2)x_at_node it contains x value at each node
3)once x_at_node table populated, suming all x’s mod of1000000007

On Sun, 25 Apr 2021, 20:56 Benzir Ahammed Shawon, <[email protected]>
wrote:

> 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
> <https://groups.google.com/d/msgid/google-code/ad485df3-94ac-4c5d-a277-4fe3e503f657n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 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/CAH5vfnOKkzgo3dwu5YmUtP4%2B%3D9CEtU6hHZ7n9YKZVD2eVyYXEQ%40mail.gmail.com.

Reply via email to