Search
 
SCRIPT & CODE EXAMPLE
 

CPP

Hiring Test codechef solution in c++

#include<iostream>
#define ll long long
#include<vector>
#include<algorithm>
using namespace std;

void solve() {
	string s;
	ll n, m;
	cin >> n >> m;
	ll x, y;
	cin >> x >> y;
	for (int i = 0; i < n; i++)
	{
		vector<char> v(m);
		for (int i = 0; i < m; i++)
		{
			cin >> v[i];
		}
		ll countF = 0, countP = 0;
		for (int i = 0; i < m; i++)
		{
			if (v[i] == 'P')
				countP++;
			if (v[i] == 'F')
				countF++;
		}

		if (countF >= x)
			s += "1";
		else if (countF == x - 1 && countP >= y)
			s += "1";
		else
			s += "0";
	}
	cout << s << "
";
}

int main()
{
	int t;
	cin >> t;

	while (t--)
	{
		solve();
	}

	return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: determining whether a array is a subsequence of another array 
Cpp :: c++ to assembly 
Cpp :: what is imposter syndrome 
Cpp :: c++ vector merge algorithm 
Cpp :: Problems in your to-do list codechef solution in c++ 
Cpp :: floating point exception 
Cpp :: c++ copy pointer vector to static 
Cpp :: this is my p phone number in punjabi 
Cpp :: sin trigonometric function 
Cpp :: C++ Battery Low 
Cpp :: namespace c++ 
Cpp :: pum game in c++ 
Cpp :: c++ string not printing 
Cpp :: Processing a string- CodeChef Solution in CPP 
Cpp :: initializer before void c++ 
Cpp :: how to make negative number positive in c++ 
Cpp :: inverse lerp c++ 
Cpp :: c++ max and min of vector 
Cpp :: cin in c++ 
Cpp :: modify value in map c++ 
Cpp :: use of strtok 
Cpp :: c++ handling 
Cpp :: how to find maximum value in c++ 
C :: unity change transparency script 
C :: check dns server in linux 
C :: check if string starts with c 
C :: bootstrap 5 modal not working vue js 3 
C :: how to declare a integer list on c 
C :: nested loop in c 
C :: c output 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =