Search
 
SCRIPT & CODE EXAMPLE
 

C

Chef in Vaccination Queue codechef solution in c++

#include<iostream>
#include<algorithm>
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 << "
";
	}
};
int main()
{
	solution ss;

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

	return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: syntax of for loop in c stack over flow 
C :: when to add & in snacf c 
C :: write a c program to find out ncr factor of given number 
C :: C (K&R) 
C :: C Why enums are used? 
C :: networkx remove attributes 
C :: C linked sorted lists 
C :: C Nested if...else 
C :: how to know a type of a numbe in c 
C :: python to c converter online free 
C :: python adding calculator 
C :: Wait until an animation finishes - Selenium, Java 
C :: C programming statician 
C :: function declaration in c 
C :: bit wise operation 
C :: scanf autotrash c 
C :: split string at space C 
C :: C printf Declaration 
C :: in c check if triangle is a right triangle 
Dart :: dart random number 
Dart :: java utils wait for seconds 
Dart :: flutter positioned center horizontally 
Dart :: Flutter: Setting the height of the AppBar 
Dart :: flutter textfield with icon onclick 
Dart :: how to get first word of a sentence in flutter 
Dart :: Floating Action Button rectangular shaped 
Dart :: flutter reverse list 
Dart :: how to replace commas in model array of strings in dart 
Dart :: Flutter how to use ListTile Threeline 
Dart :: flutter capture image from camera 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =