Contest Duration: - (local time) (110 minutes) Back to Home

Submission #845031

Source Code Expand

Copy
```import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.InputStream;

/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
PrintWriter out = new PrintWriter(outputStream);
solver.solve(1, in, out);
out.close();
}

public void solve(int testNumber, InputReader in, PrintWriter out) {
int n = in.nextInt();
long[] a = new long[n];
for (int i = 0; i < n; ++i) a[i] = in.nextLong();
long res = 0;
long rem = 0;
for (long x : a) {
long y = x;
x += rem;
res += x / 2;
rem = x % 2;
if (y == 0) rem = 0;
}
out.println(res);
}

}

public StringTokenizer tokenizer;

tokenizer = null;
}

public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}

public int nextInt() {
return Integer.parseInt(next());
}

public long nextLong() {
return Long.parseLong(next());
}

}
}

```

#### Submission Info

Submission Time 2016-08-21 21:10:29+0900 B - Simplified mahjong Petr Java8 (OpenJDK 1.8.0) 400 2150 Byte AC 339 ms 20924 KB

#### Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
 AC × 2
 AC × 24
Set Name Test Cases
Sample s1.txt, s2.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, s1.txt, s2.txt
Case Name Status Exec Time Memory
01.txt AC 283 ms 19836 KB
02.txt AC 323 ms 19988 KB
03.txt AC 299 ms 20072 KB
04.txt AC 295 ms 20096 KB
05.txt AC 291 ms 19948 KB
06.txt AC 283 ms 20052 KB
07.txt AC 303 ms 20924 KB
08.txt AC 339 ms 20472 KB
09.txt AC 287 ms 20052 KB
10.txt AC 311 ms 20368 KB
11.txt AC 255 ms 20616 KB
12.txt AC 298 ms 20424 KB
13.txt AC 295 ms 20192 KB
14.txt AC 298 ms 20016 KB
15.txt AC 251 ms 19412 KB
16.txt AC 292 ms 19880 KB
17.txt AC 298 ms 20360 KB
18.txt AC 158 ms 8148 KB
19.txt AC 151 ms 8148 KB
20.txt AC 151 ms 8148 KB
21.txt AC 157 ms 8148 KB
22.txt AC 155 ms 8148 KB
s1.txt AC 155 ms 8276 KB
s2.txt AC 155 ms 8144 KB