Alice has a bucket of water initially having
litres of water in it. The maximum capacity of the bucket is liters.
Alice turned on the tap and the water starts flowing into the bucket at a rate of litres/hour. She left the tap running for exactly hours. Determine whether the bucket has been overflown, filled exactly, or is still left unfilled.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases. The description of the test cases follows.
- Each test case consists of a single line of input containing four space-separated integers .
Output Format
For each test case, print the answer on a new line:
- If the bucket has overflown print
overflow
- If it is exactly filled print
filled
- If it is still unfilled, print
unfilled
You may print each character of the string in uppercase or lowercase (for example, the strings filled
, FIlled
, fiLLed
, and FILLED
will all be treated as identical).
Constraints
Subtasks
- Subtask 1 (100 points):
- Original constraints.
Sample Input 1
4
1 2 3 4
10 70 10 6
2 100 4 3
4 3 2 1
Sample Output 1
overFlow
filled
Unfilled
overflow
Explanation
Test case : Initially the bucket had litre of water, we then added litres of water for hours. Thus, the total bucket inflow was litres. Since this is greater than the capacity of litres, the bucket will OVERFLOW
Test case : Initially the bucket had litres of water, we then added litres of water for hours. Thus, the total bucket inflow was litres. Since this is equal to the capacity of litres, the bucket will be FILLED
Test case : Initially the bucket had litres of water, we then added litres of water for hours. Thus, the total bucket inflow was litres. Since this is lesser than the capacity of litres, the bucket will be UNFILLED
.
Test case : Initially the bucket had litres of water, we then added litres of water for hours. Thus, the total bucket inflow was litres. Since this is more than the capacity of litres, the bucket will OVERFLOW
.
solution in cpp
- #include<iostream>
- #define ll long long
- #include<vector>
- #include<stack>
- #include<string>
- #include<algorithm>
- using namespace std;
- void solve()
- {
- ll w, x, y, z, total;
- cin >> w >> x >> y >> z;
- total = w + (y * z);
- if (total == x)
- {
- cout << "filled\n";
- }
- else if (total > x)
- {
- cout << "overFlow\n";
- }
- else
- {
- cout << "Unfilled\n";
- }
- }
- int main()
- {
- int t;
- cin >> t;
- while (t--)
- {
- solve();
- }
- return 0;
- }
No comments:
Post a Comment