Skip to content

Commit e18dd35

Browse files
committed
renamed
1 parent 829a2d7 commit e18dd35

File tree

11 files changed

+20
-0
lines changed

11 files changed

+20
-0
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
const int nax = 1005;
4+
int t[nax];
5+
int main() {
6+
int n, a;
7+
scanf("%d%d", &n, &a);
8+
for(int i = 1; i <= n; ++i)
9+
scanf("%d", &t[i]);
10+
int answer = 0;
11+
for(int i = 1; i <= n; ++i) if(t[i]) {
12+
// can we catch criminal in city i?
13+
int distance = i - a; // distance from a
14+
int j = a - distance; // the other city at the same distance
15+
if(j < 1 || j > n || t[i] == t[j])
16+
++answer;
17+
}
18+
printf("%dn", answer);
19+
return 0;
20+
}

0 commit comments

Comments
 (0)