CF 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; }