Submission #3226538


Source Code Expand

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = scan.nextInt();
		}
		Arrays.sort(s);
		boolean f = true;;
		for (int i = 0; i < n; i++) {
			if (s[i] % 10 != 0) {
				f = false;
			}
		}

		int ans = 0;
		if (f) {
			System.out.println(ans);
			return;
		}
		for (int i = 0; i < n; i++) {
			ans += s[i];
		}
		if (ans % 10 != 0) {
			System.out.println(ans);
			return;
		}

		for (int i = 0; i < n; i++) {
			ans -= s[i];
			if (ans % 10 != 0) {
				System.out.println(ans);
				return;
			} else {
				ans += s[i];
			}
		}
	}
}

Submission Info

Submission Time
Task C - Bugged
User sarashin
Language Java8 (OpenJDK 1.8.0)
Score 300
Code Size 777 Byte
Status AC
Exec Time 110 ms
Memory 23764 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 12
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12
Case Name Status Exec Time Memory
a01 AC 94 ms 19284 KB
a02 AC 95 ms 19540 KB
a03 AC 93 ms 20948 KB
b04 AC 94 ms 18772 KB
b05 AC 110 ms 20564 KB
b06 AC 99 ms 21332 KB
b07 AC 99 ms 23252 KB
b08 AC 109 ms 23764 KB
b09 AC 99 ms 19412 KB
b10 AC 92 ms 20688 KB
b11 AC 99 ms 21844 KB
b12 AC 110 ms 21076 KB