Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3) A
Description
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!
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.
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.
4 3 9
2 2 L
4 3 24
4 3 R
2 4 4
1 2 R
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.
题意:告诉我们座位的排序方式,让我们找出k号是几行几列,是左还是右
解法:数学计算(奇数偶数为L,R,列可以通过k/x求出,行这里我先计算(y-1)有多少个数字,再调整)
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n,m,k;
int a[];
int x,y;
int t;
int main()
{
cin>>n>>m>>k;
x=m*;
if(k%x==)
{
y=k/x;
}
else
{
y=k/x+;
}
if(k%==)
{
if(y==)
{
cout<<y<<" "<<(k+)/<<" "<<"R"<<endl;
}
else
{
cout<<y<<" "<<(k-(y-)**m+)/<<" "<<"R"<<endl;
}
}
else
{
if(y==)
{
cout<<y<<" "<<(k+)/<<" "<<"L"<<endl;
}
else
{
cout<<y<<" "<<(k-(y-)**m+)/<<" "<<"L"<<endl;
}
}
return ;
}
Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3) A的更多相关文章
- Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3) C
Description Santa Claus has Robot which lives on the infinite grid and can move along its lines. He ...
- Codeforces Round #389 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 3) B
Description Santa Claus decided to disassemble his keyboard to clean it. After he returned all the k ...
- 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, Rated, Based on Technocup 2017 - Elimination Round 3) 圣诞之夜!
A. Santa Claus and a Place in a Class 模拟题.(0:12) 题意:n列桌子,每列m张桌子,每张桌子一分为2,具体格式看题面描述.给出n,m及k.求编号为k的桌子在 ...
- Codeforces Round #380 (Div. 1, Rated, Based on Technocup 2017 - Elimination Round 2)
http://codeforces.com/contest/737 A: 题目大意: 有n辆车,每辆车有一个价钱ci和油箱容量vi.在x轴上,起点为0,终点为s,中途有k个加油站,坐标分别是pi,到每 ...
- codeforces Codeforces Round #380 (Div. 1, Rated, Based on Technocup 2017 - Elimination Round 2)// 二分的题目硬生生想出来ON的算法
A. Road to Cinema 很明显满足二分性质的题目. 题意:某人在起点处,到终点的距离为s. 汽车租赁公司提供n中车型,每种车型有属性ci(租车费用),vi(油箱容量). 车子有两种前进方式 ...
- Codeforces Round #380 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 2) E. Subordinates 贪心
E. Subordinates time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- Codeforces Round #380 (Div. 2, Rated, Based on Technocup 2017 - Elimination Round 2) D. Sea Battle 模拟
D. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input ...
随机推荐
- C++中为什么要将析构函数定义成虚函数
构造函数不可以是虚函数的,这个很显然,毕竟虚函数都对应一个虚函数表,虚函数表是存在对象内存空间的,如果构造函数是虚的,就需要一个虚函数表来调用,但是类还没实例化没有内存空间就没有虚函数表,这根本就是个 ...
- 本地代码如何通过TortoiserGit提交到GitHub
昨天博文给大家讲解了一下如何本地安装TortoiseGit http://www.cnblogs.com/xinlj/p/5978730.html,今天为大家讲一下如何通过TortoiseGit将本地 ...
- oracle 参考
create or replace function fun_try(v_name varchar,v_outname out varchar)return varchar2 is Result va ...
- input只能输入数字并限制长度
<style> /*在chrome下移除input[number]的上下箭头*/ input::-webkit-outer-spin-button,input::-webkit-inner ...
- Git 常见的一些小命令
Git 常见的一些命令 关于一些参数比较多,比较复杂的都有单独进行介绍 1. git cherry-pick 挑拣命令,当我们不想合并分支,或者git pull 更新仓库,而是 ...
- NSArray
版权声明:本文为博主原创文章,未经博主允许不得转载. 数组是一个元素有序.元素可重复的集合,在iOS编程中经常被用到,而Foundation框架提供了数组对象.数组对象包括不可修改的数组对象NSArr ...
- Python基础-字符编码与转码
***了解计算机的底层原理*** Python全栈开发之Python基础-字符编码与转码 需知: 1.在python2默认编码是ASCII, python3里默认是utf-8 2.unicode 分为 ...
- js统计,然后去重例子
var list=new Array(); for(var i=0;i<result.length;i++){ examsubject=result[i].examsubject; list.a ...
- J2EE环境配置与工具使用
一.Java SDK安装 J2SE最新版安装地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html,包括JDK和JR ...
- Spting--DI/IOC
DI/IOC <bean> 代表由容器构建的对象(通过反射构建,且类必须有无参的构造方法) 公共属性 id="唯一的id" 在容器中是唯一的 name="类 ...