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.
The picture illustrates the first and the second samples.
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.
Example
4 3 9
2 2 L
4 3 24
4 3 R
2 4 4
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.
*/
#include <iostream> using namespace std; int main() {
int n, m, k;
cin>>n>>m>>k; int h, l;
int t;
t = (k+) / ;
//cout<<t<<endl;
l = t / m;
h = t % m;
if(h !=)
l++;
else if(h == )
{
h=m;
}
cout<<l<<" "<<h<<" ";
if(k % == )
cout<<"R"<<endl;
else cout<<"L"<<endl;
return ;
}
Santa Claus and a Place in a Class的更多相关文章
- codeforces 748E Santa Claus and Tangerines
E. Santa Claus and Tangerines time limit per test 2 seconds memory limit per test 256 megabytes inpu ...
- Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3) D. Santa Claus and a Palindrome STL
D. Santa Claus and a Palindrome time limit per test 2 seconds memory limit per test 256 megabytes in ...
- Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3) E. Santa Claus and Tangerines
E. Santa Claus and Tangerines time limit per test 2 seconds memory limit per test 256 megabytes inpu ...
- Codeforces Round #389 Div.2 E. Santa Claus and Tangerines
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- Codeforces Round #389 Div.2 D. Santa Claus and a Palindrome
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- Codeforces Round #389 Div.2 C. Santa Claus and Robot
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- Codeforces Round #389 Div.2 B. Santa Claus and Keyboard Check
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...
- Codeforces Round #389 Div.2 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 standa ...
- Santa Claus and a Palindrome
Santa Claus and a Palindrome 题目链接:http://codeforces.com/contest/752/problem/D 贪心 很自然地,可以想到,若subS不是回文 ...
- Santa Claus and Tangerines
Santa Claus and Tangerines 题目链接:http://codeforces.com/contest/752/problem/E 二分 显然直接求答案并不是很容易,于是我们将其转 ...
随机推荐
- 中国移动基于ARM/x86服务器的Ceph性能对比
2018年11月17日,Ceph中国行首次走进杭州,万众期待的杭州站沙龙如期而至,虽然杭州已经开始降温,阵雨不断,但活动现场依然热度爆表,杭州各大IT公司的从业人员和Ceph爱好者纷纷而来. 中国移动 ...
- 经典算法 Manacher算法详解
内容: 1.原始问题 =>O(N^2) 2.Manacher算法 =>O(N) 1.原始问题 Manacher算法是由题目“求字符串中长回文子串的长度”而来.比如 abcdcb 的 ...
- LaunchFaster 启动器工具 - 类似 Rolan 和音速启动的图标式快捷启动软件
LaunchFaster 启动器是本人近期编写的一款windows平台上快速启动应用的开源工具软件. LaunchFaster 启动器是一款类似于 Rolan 和 音速启动 和 Lily 的图标形式的 ...
- python数据结构之链表(一)
数据结构是计算机科学必须掌握的一门学问,之前很多的教材都是用C语言实现链表,因为c有指针,可以很方便的控制内存,很方便就实现链表,其他的语言,则没那么方便,有很多都是用模拟链表,不过这次,我不是用模拟 ...
- [Flutter] Image.File 加载图像时文件内容变化显示不变解决
在Flutter中,我们可以用下面的代码从文件中加载图像: Image.file(File(_fileName)); 这个时候,当_fileName这个文件名称和路径不变,文件内容变化时,Flutte ...
- 1.scrapyd部署相关问题
部署scrapy爬虫项目到6800上 启动scrapyd 出现问题 1: scrapyd-deloy -l 未找到相关命令 scrapyd-deploy -l 可以看到当前部署的爬虫项目,但是当我输 ...
- sql server 定期自动清理日志
https://blog.csdn.net/dqs78833488/article/details/51372491
- win10/win7 笔记本 开启虚拟无线 批处理
Microsoft Virtual WiFi Miniport Adapter 一.看网络网卡 有多出的这一项“Microsoft Virtual WiFi Miniport Adapter”,那么说 ...
- H5特性回顾
canvas 绘画, video 媒介回放 audio元素 对本地离线存储的更好支持, 新的特殊内容 - 元素 比如 article,footer,header,nav,section, 新的表单控件 ...
- dapper.net 转载
Dapper.NET——轻量ORM Dapper.NET使用 本文目录 Dapper.NET使用 1.为什么选择Dapper 2.以Dapper(4.0)为例. 2.1 在数据库中建立几张表. 2 ...