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

Common Board

Java code, Test is #3: 1087
Posted by Fadeev.E.V 25 Aug 2011 22:40
Hello!
Please tell me where my mistake.

_________________________________________
import java.util.Scanner;
public class gf {
        public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

      int i, s = 0, count = 0;

      int n = sc.nextInt();

      int m = sc.nextInt();

      int Ak[] = new int[m];

        for(i = 0; i < m; ++i) {
            Ak[i] = sc.nextInt();
            s+=Ak[i];
            count++;
        }


            if(n==s) {
                if(count % 2 == 0) System.out.println("1");
                else
                    System.out.println("2");
            }
            else System.out.println("2");


    }

Edited by author 25.08.2011 22:41

Edited by author 25.08.2011 22:41

Edited by author 25.08.2011 22:41

Edited by author 25.08.2011 22:42