fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. unsigned long a,b,c;
  6. cin>>a>>b>>c;
  7. if (a<b&&a<c || a==c&&a<b){
  8. cout<<a;
  9. }
  10. else if (c<a&&c<b || b==c&&a>b){
  11. cout<<c;
  12. }
  13. else if (b<a&&b<c && a<c){
  14. cout<<b+((a-b)/2);
  15. }
  16. else if (b<a&&b<c && a>c && ((a-b)/2)>(c-b)){
  17. cout<<b+(c-b);
  18. }
  19. else if (b<a&&b<c && a>c && ((a-b)/2)==(c-b)){
  20. cout<<b+(c-b);
  21. }
  22. else if (b<a&&b<c && a>c && ((a-b)/2)<(c-b)){
  23. cout<<b+((a-b)/2);
  24. }
  25.  
  26. else if (a==b==c || a==b&&a<c){
  27. cout<<a;
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0.01s 5392KB
stdin
640888406240047987 374226571365332132 461101106400641213
stdout
461101106400641213