Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <cstring>
- using namespace std;
- int main() {
- int n,k,r,ans=0;
- cin>>n>>k;
- for (int i=0;i<k;i++){
- cin>>r;
- if (r<=0){
- cout<<ans<<endl;
- return 0;
- }
- ans++;
- }
- int last=r;
- while((ans<n)&& (cin>>r)&&(r==last)){
- ans++;
- }
- cout<<ans<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment