fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. int b1, b2, b3, need, pas;
  7. cin >> b1 >> b2 >> b3;
  8. need = (b1 + b2 + b3) / 3;
  9. if ((b1 + b2 + b3) % 3!=0) {
  10. cout << "IMPOSSIBLE";
  11. return 0;
  12. }
  13. else cout << (abs(b1 - need) + abs(b2 - need) + abs(b3 - need))/2;
  14. return 0;
  15. }
Success #stdin #stdout 0s 15232KB
stdin
100 100 100
stdout
Standard output is empty