My issue
include <stdio.h>
int main() {
// your code goes here
int t;
scanf(“%d”, & t);
while (t--)
{
int N, K;
scanf("%d %d", & N, & K);
int x;
for (int i = 0; i < N; i++)
{
scanf("%d", & x);
if (x <= K)
{
printf("1 ");
K = K - x;
} else
{
printf("0 ");
}
}
printf("\n");
}
}
what could be wrong in my approch
My code
#include <stdio.h>
int main() {
// your code goes here
int t;
scanf("%d", & t);
while (t--)
{
int N, K;
scanf("%d %d", & N, & K);
int x;
for (int i = 0; i < N; i++)
{
scanf("%d", & x);
if (x <= K)
{
printf("1 ");
K = K - x;
} else
{
printf("0 ");
}
}
printf("\n");
}
}
Problem Link: ATM Machine Practice Coding Problem