Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

what is wrong in d code

$
0
0
#include<iostream>
using namespace std;
int main()
{
    int t,n,k,i;
    cin>>t;
    while(t--)
    {
        cin>>n>>k;

        if(n==1)
        {
        if(k==1)
        cout<<"1"<<endl;
        else
        cout<<"-1"<<endl;
        }
        else
        {

        if(k>n/2)
        cout<<"-1"<<endl;
        else {

        for(i=1;i<=k;i++)
        {
            cout<<(i<<1);



        }cout<<endl;
        }
        }



    }
    return 0;
}

Viewing all articles
Browse latest Browse all 39796


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>