Output is correct yet giving WA on submitting Alex Goes Shopping

Hi, my approach to the problem is to just check whether the total money available is divisible by each priced item in the array or not. If it is then I increment the counter otherwise not. At last if counter == k, then yes shopkeeper is right otherwise not. Thank you

MY CODE:
#include<bits/stdc++.h>
using namespace std;
#define lli long long int

int main() {
lli n;
cin >> n;
lli arr[n];
for(lli i = 0; i < n; i++) {
cin >> arr[i];
}
lli q;
cin >> q;
while(q–) {
lli A, k, possible = 0;
cin >> A >> k;
for(lli i = 0; i < n; i++) {
if(A % arr[i] == 0) {
possible++;
}
}
(possible == k) ? cout << β€œYes” : cout << β€œNo”;
cout << endl;
}
return 0;
}

@Vinayak-Bhardwaj, write greate than equal to not just equal to while comparing possible and k

okay thank you so much.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.