Buy 2 Get 1 Free Solution
Codechef March Lunchtime 2022
Problem Code : SALE2
Solution :
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
using namespace std;
void solve()
{
ll n, x;
cin >> n >> x;
cout << ((n / 3) * 2 * x) + (n % 3) * x << "\n";
}
int main()
{
ll t;
cin >> t;
while (t--)
{
solve();
}
}
Comments
Post a Comment