#include <bits/stdc++.h>using namespace std; class VampireTree{ public: int maxDistance(vector <int> num) { int sum = 0; int nonOne = 0; for(auto deg : num) { sum += deg; if(deg > 1) nonOne += 1; } if(sum != (num.size()-1) * 2) return -1; return nonOne + 1; }};
Standard input is empty
/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
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!