MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

CodeChef_problems/Chef and Steps/solution.cpp:6–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4using namespace std;
5
6int main() {
7 // your code goes here
8 int t, n, k, x, i;
9 cin>>t;
10 string s;
11 while(t--)
12 {
13 s = "";
14 cin>>n>>k; //Taking Input of n = No. of distances and k = Chef's step length
15 int x[n];
16 for(i=0;i<n;i++)
17 {
18 cin>>x[i]; //Taking Input distance of i'th path
19 if(x[i]%k==0) //if the distance of i'th place is traversable then add 1 into the string s
20 s = s+"1";
21 else
22 s = s+"0"; //If the chef can not travel to i'th place then add 0 to the string
23 }
24 cout<<s<<endl; //finally print the pattern obtained for each testcase
25 }
26 return 0;
27}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected