CF 158A - Next Round

题目:158A - Next Round

思路:水

 

#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;
int num[51];
int main()
{
    int n,k,x;
    int ans=0;
    cin>>n>>k;
    for(int i=1;i<=n;i++)
        cin>>num[i];
    int tmp=k;
    while(tmp<=n&&num[tmp]==num[tmp+1])
        tmp++;
    while(num[tmp]==0&&tmp>0)
        tmp--;
    cout<<tmp<<endl;
    return 0;
}
View Code

 

posted @ 2013-07-24 15:57  over_flow  阅读(171)  评论(0编辑  收藏  举报