原题链接:http://codeforces.com/problemset/problem/158/A
2.遇0截止
#include<cstdio>
int main()
{
int n, num;
scanf("%d%d", &n, &num);
int s[110] = {0};
for(int i = 0; i < n; i++)
scanf("%d", &s[i]);
int cnt = 0;
for(int i = 0; i < n; i++)
{
if(s[i] == 0 && i <= num - 1)
{
printf("%d\n", i);
return 0;
}
else if(s[i] >= s[num - 1])
cnt++;
}
printf("%d\n", cnt);
return 0;
}