Search code examples
javalogic

I can't find my mistake in a "Codeforces" problem


The question is- https://codeforces.com/problemset/problem/231/A I was pretty sure I found the right solution in Java and it worked properly when I tried it, but when I submitted it, it said error in test 1. It would be a great help if someone can point out the mistake. My coide is below:

import java.util.*;
public class A_Team {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter Number of Question: ");
        int count = 0;
        int loop = sc.nextInt();
        for (int i = 0; i < loop; i++) {
            int arr[] = new int[3];
            for (int j = 0; j < 3; j++) {
                arr[j] = sc.nextInt();
            }
            if(arr[0] + arr[1] + arr[2] >= 2){
                count = count + 1;
            }
        }
        System.out.println(count);
    }
}

Note: Please don't ask to change the language, I am new to programing and I only know bits of C and Java only.


Solution

  • Usually these code challenges don't want you to print anything but the answer. They are usually judged or graded by automated software that is looking for an answer in a precise format. Remove System.out.println("Enter Number of Question: ");