Codeforces Round #389 Div.2 A. Santa Claus and a Place in a Class
Santa Claus is the first who came to the Christmas Olympiad, and he is going to be the first to take his place at a desk! In the classroom there are n lanes of m desks each, and there are two working places at each of the desks. The lanes are numbered from 1 to n from the left to the right, the desks in a lane are numbered from 1 to m starting from the blackboard. Note that the lanes go perpendicularly to the blackboard, not along it (see picture).
The organizers numbered all the working places from 1 to 2nm. The places are numbered by lanes (i. e. all the places of the first lane go first, then all the places of the second lane, and so on), in a lane the places are numbered starting from the nearest to the blackboard (i. e. from the first desk in the lane), at each desk, the place on the left is numbered before the place on the right.
![](http://codeforces.com/predownloaded/be/22/be22cf2145650e53ec680c6c6808cd4444124fd3.png)
Santa Clause knows that his place has number k. Help him to determine at which lane at which desk he should sit, and whether his place is on the left or on the right!
InputThe only line contains three integers n, m and k (1 ≤ n, m ≤ 10 000, 1 ≤ k ≤ 2nm) — the number of lanes, the number of desks in each lane and the number of Santa Claus' place.
OutputPrint two integers: the number of lane r, the number of desk d, and a character s, which stands for the side of the desk Santa Claus. The character s should be "L", if Santa Clause should sit on the left, and "R" if his place is on the right.
Examples input4 3 9output
2 2 Linput
4 3 24output
4 3 Rinput
2 4 4output
1 2 RNote
The first and the second samples are shown on the picture. The green place corresponds to Santa Claus' place in the first example, the blue place corresponds to Santa Claus' place in the second example.
In the third sample there are two lanes with four desks in each, and Santa Claus has the fourth place. Thus, his place is in the first lane at the second desk on the right.
模拟题,随便乱搞。
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> #include<queue> using namespace std; const int mxn=100010; int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0' && ch<='9'){x=x*10-'0'+ch;ch=getchar();} return x*f; } int n,m,k; int main(){ int i,j; n=read();m=read();k=read(); int tmp=(k+1)/2; int p=(tmp+m-1)/m; int s=(tmp)%m; if(!s)s=m; cout<<p<<" "<<s<<" "; if(k&1)printf("L\n"); else printf("R\n"); return 0; }
- A. Santa Claus and a Place in a Class
- Santa Claus and a Place in a Class (Codeforces-748A)
- Codeforces Round #389 (Div. 2)A. Santa Claus and a Place in a Class(水题)
- CF # 389 Santa Claus and a Place in a Class
- 【codeforces 748A】Santa Claus and a Place in a Class
- 【codeforces 752A】Santa Claus and a Place in a Class
- Codeforces 748A-Santa Claus and a Place in a Class
- 748 A. Santa Claus and a Place in a Class codeforces
- 【Codeforces Round #389】Codeforces 752A Santa Claus and a Place in a Class
- How to place all WPF commands and related events centrally in a static class
- A. Santa Claus and a Place in a Class
- difference between Abstract class and interface in java
- NSAutoReleaseNoPool(): Object 0x********* of class NSConreteData autoreleased with no pool in place
- Difference between @Class and #import in Objective C
- What is the Difference Between Type and Class in
- Partial mock local private method or public method in the class and suppress static initial block
- *** __NSAutoreleaseNoPool(): Object 0x6013810 of class __NSArrayI autoreleased with no pool in place
- When the C Run-Time (CRT) library and Microsoft Foundation Class (MFC) libraries are linked in the w
- The Difference of Class.forName()、Class.forName().newInstance() and New in Java
- Java中的抽象类和接口 (Abstract Class and Interface in Java)