INSURANCE-EDITORIAL

PROBLEM LINK:

Contest
Practice

Setter: abhi_inav
Testers: tejas10p, rivalq
Editorialist: kiran8268

DIFFICULTY:

475

PREREQUISITES:

None

PROBLEM:

Given the maximum rebatable amount X and the amount for repairing as Y, our objective is to determine the amount that will be rebated by the insurance company.

EXPLANATION:

There are only two cases :
a. The amount for repairing , Y \le X. Then the amount rebated by the insurance company will be Y.
b. The amount for repairing , Y > X. Then the amount rebated by the insurance company will be X.

TIME COMPLEXITY:

Time complexity is O(1).

SOLUTION:

Editorialist's Solution
int t;
	cin>>t;
	while(t--)
	{
	    int x,y;
	    cin >> x >> y;
	    if(y <= x) cout << y << endl;
	    else cout << x << endl;
	}

Magic

1 Like