My issue
please tell me what should be the changes in my code to get answer
My code
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
int main() {
// your code goes here
int t = 100000;
for (int j = 0; j < t; j++)
{
ll n, g;
cin >> n >> g;
ll total = ((n) * (n + 1)) / 2;
if (n % 2 == 0)
{
total -= (((n / 2) - 1) * ((n / 2) + 1) - 1) / 2;
} else
{
total -= ((n / 2) * ((n / 2) + 1)) / 2;
}
ll count = 0;
while (total != 0)
{
if (total % 2 != 0)
count++;
total /= 2;
}
if ((count % mod) == g)
cout << "CORRECT" << endl;
else
cout << "INCORRECT" << endl;
}
}
Problem Link: Climbing Stairs Practice Coding Problem