ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1910. Titan Ruins: Hidden Entrance

No subject
Posted by Andrey 25 Jan 2013 20:51
Is input always made in given range or your tests may input not allowed numbers
(like -1) and i must write code to handle this input error?

Must this numbers 1 4 4 4 1 1  be randomly generated or what?  Must numbers other than 4 (in this case) be always 1? Or be the same?

Edited by author 25.01.2013 20:56

Edited by author 25.01.2013 20:56
Re: No subject
Posted by Megakrit 25 Jan 2013 22:51
The input data is in the given range.

As you can see from the problem statement, instead of the 1 and 4 there could be any number in range [1, 1000000].
Re: No subject
Posted by Andrey 29 Jan 2013 16:20
Guys, I get 'Crash' message but cant undrestand why. I run programm and it does what it has to do.
Could u please look look at the code ant point me to the problem?  This is JAVA

public static void main(String[] args) throws IOException {
        int sum=0;
        Scanner s = new Scanner (System.in);
        int a = s.nextInt ();

        BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
        String s1 = br.readLine ();


        for (int i = 0; i<a-2; i++) {
            if (s1.charAt (i)==s1.charAt (i+1) && s1.charAt (i) == s1.charAt (i+2)) {
            String s2 = Character.toString (s1.charAt (i));
            sum = Integer.parseInt (s2);
            System.out.print (sum*3 + " ");

            }
        }

        for (int i = 0; i<a-2; i++) {
            if (s1.charAt (i)==s1.charAt (i+1) && s1.charAt (i) == s1.charAt (i+2)) {

                System.out.print (s1.indexOf(s1.charAt (i))+2);

            }