748A. Santa Claus and a Place in a Class
来源:互联网 发布:mysql 开启定时器 编辑:程序博客网 时间:2024/05/16 05:35
A. Santa Claus and a Place in a Class
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output
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.
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!
Input
The 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.
Output
Print 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
Input
4 3 9
Output
2 2 L
Input
4 3 24
Output
4 3 R
Input
2 4 4
Output
1 2 R
Note
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.
题解:就是给数字找坐标,一个地方放2个数我们就可以把它想成1个数然后用一个数的思想求解所给k的位置。
#include<stdio.h>int main(){ int n,m,k; while(~scanf("%d%d%d",&n,&m,&k)) { int t=(k+1)/2; int x,y; x=(t-1)/m+1; y=(t%m)? (t%m):m; printf("%d %d ",x,y); if (k%2==0) /*其实判断偶数也可以用位运算即(k&1)*/ printf("R\n"); else printf("L\n"); }}
- 748A. Santa Claus and a Place in a Class
- A. Santa Claus and a Place in a Class
- A. Santa Claus and a Place in a Class
- CF # 389 Santa Claus and a Place in a Class
- CF # 389 Santa Claus and a Place in a Class
- 748 A. Santa Claus and a Place in a Class codeforces
- Codeforces 748A-Santa Claus and a Place in a Class
- 【codeforces 748A】Santa Claus and a Place in a Class
- Santa Claus and a Place in a Class (Codeforces-748A)
- 【codeforces 752A】Santa Claus and a Place in a Class
- 【Codeforces Round #389】Codeforces 752A Santa Claus and a Place in a Class
- Codeforces Round #389 (Div. 2)A. Santa Claus and a Place in a Class(水题)
- 753 A. Santa Claus and Candies
- cf 753A Santa Claus and Candies
- Codeforces 748 D Santa Claus and a Palindrome
- 【codeforces 752D】Santa Claus and a Palindrome
- Codeforces748D-Santa Claus and a Palindrome(贪心,构造)
- Codeforces Round #389 (Div. 2):Santa Claus and a Palindrome
- node.js基本工作原理及流程
- 团灭Windows进程通信(七)——主导地位文件映射
- RandomAccessFile读取文件阻塞住了怎么回事
- Matlab编程与数据类型 -- 多维数组
- IOS UITextFielder的placeholder 如何清除
- 748A. Santa Claus and a Place in a Class
- 18种女粉引流方法、效果、评估
- MNIST数据库处理--matlab生成mnist_uint8.mat
- 2016年总结
- 集群环境ssh免密码登录设置
- JAVA的基本类型及自动转换问题
- Spring 框架参考文档(六)-Integration之Enterprise JavaBeans (EJB) integration
- 01六大设计原则
- 关于编译版本的问题