Skip to content

Commit 0604ea5

Browse files
committed
B
1 parent 3429ec7 commit 0604ea5

File tree

1 file changed

+326
-0
lines changed

1 file changed

+326
-0
lines changed
Lines changed: 326 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,326 @@
1+
import java.text.DecimalFormat;
2+
import java.util.stream.LongStream;
3+
import java.util.stream.IntStream;
4+
import java.io.*;
5+
import java.util.*;
6+
7+
public class Main {
8+
9+
public static void main(String[] args) {
10+
FastScanner sc = new FastScanner();
11+
PrintWriter out = new PrintWriter(System.out);
12+
// int t = sc.nextInt();
13+
// while(t-->0){
14+
Naveen problem = new Naveen(sc);
15+
problem.solve(out);
16+
//}
17+
out.flush();
18+
}
19+
20+
}
21+
22+
class Naveen {
23+
24+
int n;
25+
int[] arr;
26+
27+
28+
Naveen(FastScanner sc) {
29+
30+
n = sc.nextInt();
31+
arr = sc.arrayInt(n);
32+
}
33+
void solve(PrintWriter out) {
34+
int count =0;
35+
for(int i =0;i<n;i++){
36+
if(i%2==0&&arr[i]%2==1){
37+
count++;
38+
}
39+
}
40+
out.println(count);
41+
42+
43+
}
44+
45+
46+
}
47+
48+
class FastScanner {
49+
50+
private final InputStream in = System.in;
51+
private final byte[] buffer = new byte[1024];
52+
private int ptr = 0;
53+
private int buflen = 0;
54+
55+
private boolean hasNextByte() {
56+
if (ptr < buflen) {
57+
return true;
58+
} else {
59+
ptr = 0;
60+
try {
61+
buflen = in.read(buffer);
62+
} catch (IOException e) {
63+
e.printStackTrace();
64+
}
65+
if (buflen <= 0) {
66+
return false;
67+
}
68+
}
69+
return true;
70+
}
71+
72+
private int readByte() {
73+
if (hasNextByte()) {
74+
return buffer[ptr++];
75+
} else {
76+
return -1;
77+
}
78+
}
79+
80+
private static boolean isPrintableChar(int c) {
81+
return 33 <= c && c <= 126;
82+
}
83+
84+
public boolean hasNext() {
85+
while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
86+
ptr++;
87+
}
88+
return hasNextByte();
89+
}
90+
91+
public String next() {
92+
if (!hasNext()) {
93+
throw new NoSuchElementException();
94+
}
95+
StringBuilder sb = new StringBuilder();
96+
int b = readByte();
97+
while (isPrintableChar(b)) {
98+
sb.appendCodePoint(b);
99+
b = readByte();
100+
}
101+
return sb.toString();
102+
}
103+
104+
public long nextLong() {
105+
if (!hasNext()) {
106+
throw new NoSuchElementException();
107+
}
108+
long n = 0;
109+
boolean minus = false;
110+
int b = readByte();
111+
if (b == '-') {
112+
minus = true;
113+
b = readByte();
114+
}
115+
if (b < '0' || '9' < b) {
116+
throw new NumberFormatException();
117+
}
118+
while (true) {
119+
if ('0' <= b && b <= '9') {
120+
n *= 10;
121+
n += b - '0';
122+
} else if (b == -1 || !isPrintableChar(b)) {
123+
return minus ? -n : n;
124+
} else {
125+
throw new NumberFormatException();
126+
}
127+
b = readByte();
128+
}
129+
}
130+
131+
public int nextInt() {
132+
long nl = nextLong();
133+
if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
134+
throw new NumberFormatException();
135+
}
136+
return (int) nl;
137+
}
138+
139+
public double nextDouble() {
140+
return Double.parseDouble(next());
141+
}
142+
143+
public int[] arrayInt(int N) {
144+
int[] array = new int[N];
145+
for (int i = 0; i < N; i++) {
146+
array[i] = nextInt();
147+
}
148+
return array;
149+
}
150+
151+
public long[] arrayLong(int N) {
152+
long[] array = new long[N];
153+
for (int i = 0; i < N; i++) {
154+
array[i] = nextLong();
155+
}
156+
return array;
157+
}
158+
159+
public double[] arrayDouble(int N) {
160+
double[] array = new double[N];
161+
for (int i = 0; i < N; i++) {
162+
array[i] = nextDouble();
163+
}
164+
return array;
165+
}
166+
167+
public String[] arrayString(int N) {
168+
String[] array = new String[N];
169+
for (int i = 0; i < N; i++) {
170+
array[i] = next();
171+
}
172+
return array;
173+
}
174+
175+
public int randomInt() {
176+
Random r = new Random();
177+
int value = r.nextInt((int) 1e6);
178+
System.out.println(value);
179+
return value;
180+
}
181+
182+
public int[] randomInt(int N) {
183+
int[] array = new int[N];
184+
Random r = new Random();
185+
for (int i = 0; i < N; i++) {
186+
array[i] = r.nextInt((int) 1e6);
187+
}
188+
System.out.println(Arrays.toString(array));
189+
return array;
190+
}
191+
192+
}
193+
194+
class My {
195+
196+
public static long lower(long arr[],long key){
197+
int low = 0;
198+
int high = arr.length-1;
199+
while(low < high){
200+
int mid = low + (high - low)/2;
201+
if(arr[mid] >= key){
202+
high = mid;
203+
}
204+
else{
205+
low = mid+1;
206+
}
207+
}
208+
return low;
209+
}
210+
public static int upper(int arr[],int key){
211+
int low = 0;
212+
int high = arr.length-1;
213+
while(low < high){
214+
int mid = low + (high - low+1)/2;
215+
if(arr[mid] <= key){
216+
low = mid;
217+
}
218+
else{
219+
high = mid-1;
220+
}
221+
}
222+
return low;
223+
}
224+
static void ans(boolean b) {
225+
System.out.println(b ? "Yes" : "No");
226+
}
227+
228+
static void ANS(boolean b) {
229+
System.out.println(b ? "YES" : "NO");
230+
}
231+
232+
static String sort(String s) {
233+
char[] ch = s.toCharArray();
234+
Arrays.sort(ch);
235+
return String.valueOf(ch);
236+
}
237+
238+
static String reverse(String s) {
239+
return new StringBuilder(s).reverse().toString();
240+
}
241+
242+
static int[] reverse(int[] array) {
243+
for (int i = 0; i < array.length / 2; i++) {
244+
int temp = array[i];
245+
array[i] = array[array.length - 1 - i];
246+
array[array.length - 1 - i] = temp;
247+
}
248+
return array;
249+
}
250+
251+
static long[] reverse(long[] array) {
252+
for (int i = 0; i < array.length / 2; i++) {
253+
long temp = array[i];
254+
array[i] = array[array.length - 1 - i];
255+
array[array.length - 1 - i] = temp;
256+
}
257+
return array;
258+
}
259+
260+
static double[] reverse(double[] array) {
261+
for (int i = 0; i < array.length / 2; i++) {
262+
double temp = array[i];
263+
array[i] = array[array.length - 1 - i];
264+
array[array.length - 1 - i] = temp;
265+
}
266+
return array;
267+
}
268+
269+
static String[] reverse(String[] array) {
270+
for (int i = 0; i < array.length / 2; i++) {
271+
String temp = array[i];
272+
array[i] = array[array.length - 1 - i];
273+
array[array.length - 1 - i] = temp;
274+
}
275+
return array;
276+
}
277+
278+
static char[] reverse(char[] array) {
279+
for (int i = 0; i < array.length / 2; i++) {
280+
char temp = array[i];
281+
array[i] = array[array.length - 1 - i];
282+
array[array.length - 1 - i] = temp;
283+
}
284+
return array;
285+
}
286+
287+
static long min(long... numbers) {
288+
Arrays.sort(numbers);
289+
return numbers[0];
290+
}
291+
292+
static int min(int... numbers) {
293+
Arrays.sort(numbers);
294+
return numbers[0];
295+
}
296+
297+
static double min(double... numbers) {
298+
Arrays.sort(numbers);
299+
return numbers[0];
300+
}
301+
302+
static long max(long... numbers) {
303+
Arrays.sort(numbers);
304+
return numbers[numbers.length - 1];
305+
}
306+
307+
static int max(int... numbers) {
308+
Arrays.sort(numbers);
309+
return numbers[numbers.length - 1];
310+
}
311+
312+
static double max(double... numbers) {
313+
Arrays.sort(numbers);
314+
return numbers[numbers.length - 1];
315+
}
316+
317+
static int sum(long number) {
318+
int sum = 0;
319+
while (number > 0) {
320+
sum += number % 10;
321+
number /= 10;
322+
}
323+
return sum;
324+
}
325+
326+
}

0 commit comments

Comments
 (0)