fork download
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. int n;
  8. int licznik = 0;
  9. int suma = 0;
  10.  
  11. cin >> n;
  12.  
  13. vector<int> ted(n);
  14.  
  15. for(int i = 0; i < n; i++) {
  16. cin >> ted[i];
  17. }
  18.  
  19. for(int i = 0; i < ted.size(); i++) {
  20. suma = suma + ted[i];
  21. }
  22.  
  23. if(suma >= 2) {
  24. licznik++;
  25. }
  26.  
  27. cout << licznik;
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 544KB
stdin
3 
1 1 0 
1 1 1 
1 0 0
stdout
1