Submission #3227312
Source Code Expand
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.stream.IntStream; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author mikit */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; Scanner in = new Scanner(inputStream); PrintWriter out = new PrintWriter(outputStream); CBugged solver = new CBugged(); solver.solve(1, in, out); out.close(); } static class CBugged { private static int ans = 0; private static final boolean[][] dp = new boolean[10001][101]; private static int[] s; public void solve(int testNumber, Scanner in, PrintWriter out) { s = IntStream.range(0, in.nextInt()).map(i -> in.nextInt()).toArray(); calc(0, 0); out.println(ans); } private static void calc(int sum, int index) { if (dp[sum][index]) { return; } dp[sum][index] = true; if (index == s.length) { if (sum % 10 > 0) { ans = Math.max(ans, sum); } return; } calc(sum, index + 1); calc(sum + s[index], index + 1); } } }
Submission Info
Submission Time | |
---|---|
Task | C - Bugged |
User | mikit |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 1508 Byte |
Status | AC |
Exec Time | 201 ms |
Memory | 28628 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | 167 ms | 28500 KB |
a02 | AC | 166 ms | 26580 KB |
a03 | AC | 168 ms | 28628 KB |
b04 | AC | 172 ms | 24404 KB |
b05 | AC | 192 ms | 26192 KB |
b06 | AC | 187 ms | 27092 KB |
b07 | AC | 201 ms | 27092 KB |
b08 | AC | 182 ms | 26964 KB |
b09 | AC | 185 ms | 24404 KB |
b10 | AC | 171 ms | 24264 KB |
b11 | AC | 190 ms | 26708 KB |
b12 | AC | 183 ms | 26196 KB |