Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.23 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. using namespace std;
  4. int main(){
  5. int n,v,i;
  6. cin>>n;
  7. v=0;
  8. int a[n];
  9. for(i=0;i<n;i++)
  10. {
  11. cin>>a[i];
  12. }
  13. for(i=1;i<=n;i++)
  14. {
  15. if((a[i]-a[i-1])==1)
  16. {
  17. v++;
  18. }
  19. }
  20. cout<<v;
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement