My issue
i am not able to solve the problem.
My code
#include <stdio.h>
int main(void) {
// your code goes here
return 0;
}
Problem Link: CVW Problem - CodeChef
i am not able to solve the problem.
#include <stdio.h>
int main(void) {
// your code goes here
return 0;
}
Problem Link: CVW Problem - CodeChef
@ajay0120
plzz refer the following solution for better understanding of the logic and implementation
#include<iostream>
using namespace std;
int main()
{
long int t,n,k,i,j;
cin>>t;
while(t--){
cin>>n>>k;
if(k==0){
for(i=1;i<=n;i++) cout<<i<<" ";
cout<<"\n";
}
else if(n%2==0 && n%k==0 && (n/k)%2==0){
for(i=1;i<=n;)
{
for(j=0;j<k;j++){
cout<<i+k<<" ";
i++;
}
for(j=0;j<k;j++){
cout<<i-k<<" ";
i++;
}
}
cout<<"\n";
}
else cout<<"CAPTAIN AMERICA EVADES\n";
}
return 0;
}