fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7. string sheeps[n] = {};
  8.  
  9. for(int i = 0; i < n; i++)
  10. cin >> sheeps[i];
  11.  
  12. int count = 0;
  13. for(int i = 0; i < n; i++)
  14. (sheeps[i] == "true")? count++ : 0;
  15.  
  16. cout << count << endl;
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5280KB
stdin
6
true false true true false true
stdout
4