Advertisement
ateyevtm

Untitled

Dec 17th, 2023
1,173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4.     int n,count = 0;
  5.     cin >> n;
  6.     int arr[n];
  7.     for (int i = 0; i < n; ++i){
  8.         cin >> arr[i];
  9.     }
  10.     for (int i = 0; i < n - 1; ++i) {
  11.         if(arr[i] % 10 + arr[i+1] % 10 < 10){
  12.             ++count;
  13.         }
  14.     }
  15.     cout << count << " ";
  16.  
  17.     return 0;
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement