Codeforces Santa Claus and a Place in a Class

/*
Lionel Messi is such a player that you may catch him, you may touch him, you may feel him
and definitely you may Love him.
Lionel Messi is Messi. A little Magician in this World.

*/

#include<bits/stdc++.h>

using namespace std;

#define fast ios_base::sync_with_stdio(false)
#define bfast cin.tie(0)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf
#define nl puts("")
#define psb push_back

typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;

const int mod = 1000007;
const int high = 100;

int main()
{
    fast;
    int n , m , i=1 , j;
    LL k , tmp;
    while(cin >> n >> m)
    {
        i = 0;

        cin >> k;

        tmp = 0;

        while(tmp < k)
        {
            tmp+=(m * 2);

            if(tmp < k) i++;
        }

        //cout << i << "\n";
        i+=1;
        //cout << tmp << "\n";
        if(tmp - k == 0 or tmp-k==1) j=m;
        else j=m - ((tmp - k)/2);


        if(k&1) cout << i << " " << j << " L\n";
        else cout << i << " " << j << " R\n";
    }

    return 0;
}

Comments

Popular posts from this blog

SPOJ-CMG - Collecting Mango

LightOJ 1009 - Back to Underworld

LeetCode Palindrome Number