World Chess Championship Solution
Codechef February Long Challenge 2022 - II
Problem Code : WCC
Solution :
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
using namespace std;
void solve()
{
ll x;
string s;
cin >> x >> s;
ll carlsen = 0, chef = 0, draw = 0;
for (ll i = 0; i < 14; i++)
{
if (s[i] == 'C')
carlsen++;
else if (s[i] == 'N')
chef++;
else
draw++;
}
if (carlsen > chef)
{
cout << 60 * x << "\n";
}
else if (carlsen < chef)
{
cout << 40 * x << "\n";
}
else
{
cout << 55 * x << "\n";
}
}
int main()
{
ll t;
cin >> t;
while (t--)
{
solve();
}
}
Comments
Post a Comment