fork(1) download
  1. // iostream is too mainstream
  2. #include <cstdio>
  3. // bitch please
  4. #include <iostream>
  5. #include <vector>
  6. #include <set>
  7. #include <map>
  8. #include <string>
  9. #include <queue>
  10. #include <stack>
  11. #include <algorithm>
  12. #define dibs reserve
  13. #define OVER9000 1234567890
  14. #define tisic 47
  15. #define soclose 10e-7
  16. #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
  17. #define chocolate win
  18. #define ff first
  19. #define ss second
  20. #define uint unsigned int
  21. // mylittlepony
  22. using namespace std;
  23.  
  24. int main() {
  25. int T;
  26. cin >> T;
  27. for(int i =0; i < T; i++) {
  28. int A[3];
  29. cin >> A[0] >> A[1] >> A[2];
  30. int ans =0;
  31. if(A[0]+A[2] == 0 || A[1]+A[2] == 0 || A[0]+A[1] == 0) ans++;
  32. else for(int j =0; j < 3; j++) for(int k =0; k < 3; k++) for(int l =0; l < 3; l++) {
  33. if(k == j || k == l || j == l) continue;
  34. if(A[j] == 0) continue;
  35. if(A[k] == 0 && A[l] > 0) continue;
  36. int x =min(A[j],min(A[k],A[l]));
  37. if(A[j]-x > 1 || A[k]-x > 1 || A[l]-x > 1) continue;
  38. if(A[j]-x == 0 && A[k]+A[l]-2*x > 0) continue;
  39. if(A[k]-x == 0 && A[l]-x > 0) continue;
  40. ans++;}
  41. cout << ans << "\n";}
  42. return 0;}
  43.  
  44. // look at my code
  45. // my code is amazing
Success #stdin #stdout 0s 3344KB
stdin
4
2 1 0
5 5 5
3 3 2
0 0 1
3 4 5
stdout
0
6
2
1