Chef in Vaccination Queue codechef solution in c++

[ad_1]

Chef in Vaccination Queue codechef solution in c++
#include
#include
using namespace std;

class solution
{
public:
	void solve()
	{
		int n, p, x, y;
		cin >> n >> p >> x >> y;
		int* arr = new int[n];
		for (int i = 0; i < n; i++)
		{
			cin >> arr[i];
		}
		int total = 0;
		for (int i = 0; i < p; i++)
		{
			if (arr[i] == 1)
				total += y;
			else
				total += x;
		}
		cout << total << "\n";
	}
};
int main()
{
	solution ss;

	int t;
	cin >> t;
	while (t--)
    {
		ss.solve();
	}

	return 0;
}

[ad_2]

Please follow and like us:
Content Protection by DMCA.com