Showing posts with label Save the Prisoner! Hacker Rank Solution in C. Show all posts
Showing posts with label Save the Prisoner! Hacker Rank Solution in C. Show all posts

Thursday, 27 August 2020

Save the Prisoner! Hacker Rank Solution in C

 #include<stdio.h>

int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        int n,m,s;
        scanf("%d%d%d",&n,&m,&s);
        int ans=(s+m-1)%n;
        if(ans == 0)
            printf("%d\n",n);
        else
            printf("%d\n",ans);

    }
}