Saturday, 29 August 2020

Rain sound Hacker Earth Solution in C

 #include<stdio.h>

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int l,r,s;
        scanf("%d%d%d",&l,&r,&s);
        int min,max;
        min=l/s;
        if(min*s < l)
            min++;

        max=r/s;
        if(min<=max)
            printf("%d %d\n",min,max);
        else
            printf("-1 -1\n");
    }
}

No comments:

Post a Comment