Solution - UVa Problem 11805 - Bafana Bafana



সল্যুশন্সঃ
#include<iostream>
using namespace std;
int main()
{
    int t;
    cin >> t;
    for(int i=1; i<=t; i++)
    {
        int n,k,p;
        cin >> n >> k >> p;
        if((p%n == 0))
            cout << "Case " << i << ": " << k << endl;
        else if((p+k) > n)
        {
            if(((p+k)%n) == 0)
                cout << "Case " << i << ": " << n << endl;
            else
                cout << "Case " << i << ": " << (p+k)%n << endl;
        }
        else if(p+k <= n)
        {
            cout << "Case " << i << ": " << p+k << endl;
        }
    }
    return 0;
}

আলোচনাঃ
যত সলভ করবেন ততই আপনার লজিক স্কিল বাড়বে।
বুঝেন নাই মনে হয়। #আয়নাবাজি :D

Comments

Popular posts from this blog

Solution - Codeforces Problem 327B - Hungry Sequence

Solution - Timus Problem 1293. Eniya

Solution - Timus Problem 1409. Two Gangsters