HOTNCOLD-Editorial

#PROBLEM-LINK
PracticeContest

Author: freemancs
Tester: pulkit_0110
Editorialist: pulkit_0110

DIFFICULTY:

CAKE-WALK.

#EXPLANATION
Equilibrium can be achieved only if the difference between the initial temperatures of tanks is divisible by 3 .
Now, if the difference between the initial temperatues of tanks divided by 3 is less than equal to m then pipe will not burst else pipe will get burst.
Here’s the code :

#include<bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin>>t;
while(t–) {
int m,tc,th;
cin>>m>>tc>>th;

  int diff=th-tc;
  
  if(diff%3==0 && m>=diff/3) 
      cout<<"No\n";
  else
      cout<<"Yes\n";
}

return 0;

}