Bomb The Base Solution
Codechef Starters - 29
Problem Code : BOMBTHEBASE
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;
ll a[n];
for (ll i = 0; i < n; i++)
{
cin >> a[i];
}
ll temp = n - 1;
while (a[temp] >= x)
{
temp--;
}
if (temp < 0)
{
cout << 0 << "\n";
}
else
{
cout << temp + 1 << "\n";
}
}
int main()
{
ll t;
cin >> t;
while (t--)
{
solve();
}
}
Comments
Post a Comment