Advertisement
Josif_tepe

Untitled

Apr 12th, 2024
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9.     int n;
  10.     cin >> n;
  11.  
  12.  
  13.    vector<int> v;
  14.     for(int i = 0; i < n; i++) {
  15.         int x;
  16.         cin >> x;
  17.         v.push_back(x);
  18.     }
  19.     int brojac=0;
  20.     int cifri =0;
  21.    for(int i=0;n>i;i++){
  22.  
  23.  
  24.    int x=v[i];
  25.     int even =1;
  26.     int golemina=0;
  27.     while(x>0) {
  28.         int cifra=x%10;
  29.         if(cifra %2==1){
  30.  
  31.  
  32.            even=0;
  33.         }
  34.          golemina++;
  35.  
  36.  
  37.        x/=10;
  38.  
  39.  
  40.    }
  41.  
  42.  
  43.   if(even==1) {
  44.  
  45.  
  46.    brojac++;
  47.     cifri+=golemina;
  48.  
  49.  
  50.    }
  51.  
  52.  
  53.   }
  54. cout<<brojac<<endl<<cifri<<endl;
  55.  
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement