aboutsummaryrefslogtreecommitdiff
path: root/codechef/weightBalance.cpp
blob: bb03054e33003718a54a7ba093219f288d6197b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<bits/stdc++.h>

using namespace std;

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tt;
	cin >> tt;
	while(tt--){
    int w1, w2, x1, x2, m;
    cin >> w1 >> w2 >> x1 >> x2 >> m;
    int weight = w2 - w1;
    if(weight >= x1 * m && weight <= x2 * m) {
      cout << 1 << '\n';
    } else {
        cout << 0 << '\n';
      }

	}
}