fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. class VampireTree
  5. {
  6. public: int maxDistance(vector <int> num)
  7. {
  8. int sum = 0;
  9. int nonOne = 0;
  10. for(auto deg : num)
  11. {
  12. sum += deg;
  13. if(deg > 1)
  14. nonOne += 1;
  15. }
  16. if(sum != (num.size()-1) * 2)
  17. return -1;
  18. return nonOne + 1;
  19. }
  20. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i586-linux-gnu/5/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty