Advertisement
semsem_elazazy

Untitled

Feb 7th, 2022
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n ;
  7.     cin>>n;
  8.     int arr[n];
  9.     for(int i=0 ;i<n ;i++)
  10.     {
  11.         cin>>arr[i];
  12.        
  13.     }
  14.     bool ch=0;
  15.     int m;
  16.     for(int i=0 ; i<n ; i++)
  17.     {
  18.         if (i%10==arr[i])
  19.         {
  20.         ch=1;
  21.         m=i;
  22.         break ;
  23.         }
  24.        
  25.        
  26.     }
  27.     if (ch ==1)
  28.     cout<<m<<endl;
  29.          
  30.  
  31.         else
  32.         cout<<-1<<endl;
  33.  
  34.            
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement