Guest User

Untitled

a guest
Jan 22nd, 2020
64
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. long long int i,j,k,l,a,b,c,n,t;
  6. cin>>t;
  7. for(i=0;i<t;i++)
  8. {
  9. cin>>a>>b>>c>>n;
  10.  
  11. long long int sum=(a+b+c);
  12. if(a>b&&a>c)
  13. {
  14. n=n-(a-b);
  15. //cout<<n<<endl;
  16. b=b+(a-b);
  17. n=n-(a-c);
  18. //cout<<n<<endl;
  19. c=c+(a-c);
  20.  
  21. }
  22. else if(b>a&&b>c)
  23. {
  24. n=n-(b-a);
  25. a=a+(b-a);
  26. n=n-(b-c);
  27.  
  28. c=c+(b-c);
  29. }
  30. else
  31. {
  32. n=n-(c-a);
  33. cout<<n<<endl;
  34. a=a+(c-a);
  35. n=n-(c-b);
  36. cout<<n<<endl;
  37. b=b+(c-b);
  38. }
  39. cout<<a<<" "<<b<<" "<<c<<" "<<n<<endl;
  40. if(n%3==0)
  41. {
  42. cout<<"YES"<<endl;
  43. }
  44. else
  45. {
  46. cout<<"NO"<<endl;
  47. }
  48.  
  49. }
  50.  
  51.  
  52. return 0;
  53. }
RAW Paste Data