Submission #1452767
Source Code Expand
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { public static void main(String[] args) throws IOException { BufferedReader tec=new BufferedReader(new InputStreamReader(System.in)); PrintWriter out=new PrintWriter(System.out); for(String line;(line=tec.readLine())!=null;){ int n=Integer.parseInt(line.trim()); int[]arr=new int[n]; for (int i = 0; i < arr.length; i++) arr[i]=Integer.parseInt(tec.readLine().trim()); if(n==1){ out.println(arr[0]/2); continue; } long x=arr[0],cont=0; for (int i = 1; i < arr.length; i++) { x+=arr[i]; cont+=x/2; if((x&1)==1&&arr[i]!=0){ x=1; }else{ x=0; } } out.println(cont); } out.close(); } }
Submission Info
Submission Time | |
---|---|
Task | B - Simplified mahjong |
User | vjudge1 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 400 |
Code Size | 818 Byte |
Status | AC |
Exec Time | 171 ms |
Memory | 30804 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
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 | 161 ms | 28756 KB |
02.txt | AC | 153 ms | 29864 KB |
03.txt | AC | 148 ms | 27860 KB |
04.txt | AC | 150 ms | 27220 KB |
05.txt | AC | 147 ms | 27476 KB |
06.txt | AC | 158 ms | 28756 KB |
07.txt | AC | 139 ms | 26964 KB |
08.txt | AC | 149 ms | 26456 KB |
09.txt | AC | 148 ms | 25684 KB |
10.txt | AC | 156 ms | 28588 KB |
11.txt | AC | 134 ms | 26432 KB |
12.txt | AC | 168 ms | 28628 KB |
13.txt | AC | 163 ms | 30804 KB |
14.txt | AC | 162 ms | 28884 KB |
15.txt | AC | 127 ms | 25172 KB |
16.txt | AC | 171 ms | 27988 KB |
17.txt | AC | 154 ms | 30676 KB |
18.txt | AC | 66 ms | 23124 KB |
19.txt | AC | 67 ms | 16852 KB |
20.txt | AC | 67 ms | 19796 KB |
21.txt | AC | 67 ms | 22996 KB |
22.txt | AC | 68 ms | 18772 KB |
s1.txt | AC | 77 ms | 21076 KB |
s2.txt | AC | 70 ms | 18260 KB |