Super simple problem. Positive Numbers – Negative Numbers.
import java.io.PrintWriter; import java.util.Scanner; /** * * @author Sanchit M. Bhatnagar * @see http://uhunt.felix-halim.net/id/74004 * */ public class P12279 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int count = 1; int X = 0; while ((X = sc.nextInt()) != 0) { int ans = 0; for (int i = 0; i < X; i++) { if (sc.nextInt() > 0) ans++; else ans--; } out.println("Case " + count + ": " + ans); count++; } out.close(); sc.close(); } }