Monday 26 September 2016

UVA 11805 - Bafana Bafana

Problem Link:UVA 11805 - Bafana Bafana
Code:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,k,p,t,i;
    cin>>t;
    for(i=1; i<=t; i++)
    {
        cin>>n>>k>>p;
        k+=p;
        k=k%n;
        if(k==0)
            k=n;
        cout<<"Case "<<i<<": "<<k<<endl;
    }
    return 0;
}

No comments:

Post a Comment