fork download
  1. using namespace std;
  2. #include <iostream>
  3. #include <fstream>
  4. #include <vector>
  5.  
  6. bool is_possible(const int a, const int b, const int c){
  7. return !(((a+b <= c) || (a+c <= b) || (b+c <= a)));
  8. }
  9.  
  10. int main(){
  11. unsigned int possible = 0;
  12. ifstream infile;
  13. infile.open("input", ios::in);
  14. int read[3];
  15. vector<int> v(9);
  16.  
  17.  
  18. unsigned int collectedCounter = 0;
  19. while(infile >> read[0] >> read[1] >> read[2]){
  20. if(collectedCounter != 3){
  21. for(int j=0; j<3; j++){
  22. v[j*3 + collectedCounter] = read[j];
  23. }
  24. collectedCounter++;
  25. }
  26. if(collectedCounter == 3) {
  27. for(int i=0; i<3; i++){
  28. possible += is_possible(v[3*i], v[3*i+1], v[3*i+2]);
  29. }
  30. collectedCounter = 0;
  31. }
  32. }
  33. cout << "Possible: " << possible;
  34.  
  35. infile.close();
  36.  
  37. return 0;
  38. }
  39.  
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Possible: 0