Farmers League Solution || Codechef May Cook-Off 2022

          

Farmers League Solution 

Codechef May Cook-Off 2022
Problem Code : LEAGUE

Solution :

#include <bits/stdc++.h>
#define ll long long int
using namespace std;

int main()
{
    ll t = 1;
    cin >> t;
    while (t--)
    {
        ll n;
        cin >> n;
        if (n % 2)
        {
            cout << 3 * ((n - 1) / 2) << "\n";
        }
        else
        {
            cout << 3 * (n - 1) - 3 * ((n - 1) / 2) << "\n";
        }
    }
}

Comments