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 2023. Donald is a postman

WA#6 can someone help me?
Posted by Julius 24 Nov 2015 23:07
can someone help me?, im trying search the error but i dont found nothing, greetings..

import java.io.PrintWriter;
import java.util.Scanner;

public class P{

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
    PrintWriter out= new PrintWriter(System.out);
        int current=1,cont=0;

    int n=in.nextInt();
        in.nextLine();
        for(int i=0;i<n;i++){
            String lec;
            lec=in.nextLine();

            if(lec.equals("Aurora") || lec.equals("Alice") ||lec.equals("Ariel") ||lec.equals("Phil")||lec.equals("Peter")||lec.equals("Olaf")||lec.equals("Phoebus")||lec.equals("Ralph")||lec.equals("Robin") ){
                    if(current==2){
                        cont=cont+1;
                    }
                    if(current==3){
                        cont=cont+2;
                    }
                    current=1;
            }
            if(lec.equals("Bambi") || lec.equals("Belle") ||lec.equals("Bolt") ||lec.equals("Mulan")||lec.equals("Mowglin")||lec.equals("Mickey")||lec.equals("Silver")||lec.equals("Simba")||lec.equals("Stitch")){
                    if(current!=2){
                        cont=cont+1;
                    }
                    current=2;
            }
            if(lec.equals("Dumbo") || lec.equals("Genie") ||lec.equals("Jiminy") ||lec.equals("Kuzko")||lec.equals("Kida")||lec.equals("Kenai")||lec.equals("Tarzan")||lec.equals("Tiana")||lec.equals("Winnie")){
                   if(current==2){
                       cont=cont+1;
                   }
                   if(current==1){
                       cont=cont+2;
                   }
                   current=3;
            }
        }

        System.out.print(cont);

    out.flush();
    }
}
Re: WA#6 can someone help me?
Posted by Julius 24 Nov 2015 23:10
solved, just a error on lec.equals("Mowglin") to lec.equals("Mowgli")

my bad