https://www.codechef.com/LTIME86B/problems/CHEFSTEP/

My solution is here: https://www.codechef.com/viewsolution/35930338

Can anyone explain, why is my solution wrong?

I have seen other’s accepted solution. The logic is same.

Please help me out!!

https://www.codechef.com/LTIME86B/problems/CHEFSTEP/

My solution is here: https://www.codechef.com/viewsolution/35930338

Can anyone explain, why is my solution wrong?

I have seen other’s accepted solution. The logic is same.

Please help me out!!

You were not printing string for different test cases in different lines. You forgot to use `print(end="\n")`

after each test case loop.

1 Like

Because you are not printing the answer on newline.

**Updated Source-Code:**

```
t = int(input().strip())
for _ in range(t):
n, k = map(int, input().strip().split())
li = list(map(int, input().strip().split()))
for i in li:
if i % k == 0:
print("1", end = "")
else:
print("0", end = "")
print()
```

1 Like

newline missing for every test case

Thank you!!

you forgot to add **print()** after the end of for loop

#include

using namespace std;

int main() {

// your code goes here

int t;

cin>>t;

while(t–)

{

long long int n,k;

cin>>n>>k;

long long int d[n];

```
for(int i=0;i<n;i++)
{
cin>>d[i];
if(d[i]%k==0)
cout<<1;
else
cout<<0;
}
```

cout<<endl;

```
}
return 0;
```

}

plz tell error of my code plzz its giving tle

Format your code first as the forum software has messed it up.