Codeforces Round #389 (Div. 2)A. Santa Claus and a Place in a Class(水题)
2016-12-26 10:23
477 查看
题目:
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 sec
4000
ond 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.
Examples
input
output
input
output
input
output
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.
题意:基本上就是看图找规律,填数字,问数字的坐标
代码:
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 sec
4000
ond 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.
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.
题意:基本上就是看图找规律,填数字,问数字的坐标
代码:
#include <stdio.h> #include <string.h> #include <iostream> #include <stack> #include <queue> #include <vector> #include <algorithm> #define mem(a,b) memset(a,b,sizeof(a)) using namespace std; int main() { int n,m,k; scanf("%d%d%d",&n,&m,&k); if(k&1) { k++; int shu=k/2; int x,y; if(shu%m==0) x=shu/m; else x=shu/m+1; if(shu%m==0) y=m; else y=shu%m; printf("%d %d L\n",x,y); } else { int shu=k/2; int x,y; if(shu%m==0) x=shu/m; else x=shu/m+1; if(shu%m==0) y=m; else y=shu%m; printf("%d %d R\n",x,y); } return 0; }
相关文章推荐
- Codeforces Round #358 (Div. 2) B. Alyona and Mex 水题
- 【Codeforces Round 370 (Div 2) A】【水题】Memory and Crow
- Codeforces Round #378 (Div. 2) E. Sleep in Class (思考,双指针,模拟)
- Codeforces Round #394 (Div. 2) A. Dasha and Stairs 水题
- Codeforces Round #379 (Div. 2) D. Anton and Chess 水题
- Codeforces Round #365 (Div. 2) 703B Mishka and trip 水题
- ICM Technex 2017 and Codeforces Round #400 (Div. 1 + Div. 2, combined)A. A Serial Killer(水题)
- Codeforces Round #447 (Div. 2) D. Ralph And His Tour in Binary Country(dfs)
- A. Odds and Ends Codeforces Round #431 (Div. 2)(水题)
- 【Codeforces Round 331 (Div 2)A】【水题】Wilbur and Swimming Pool 给出矩形1~4个顶点让你还原矩形
- Codeforces Round #356 (Div. 2) B. Bear and Finding Criminal 水题
- CF # 389 Santa Claus and a Place in a Class
- 【Codeforces Round 262 (Div 2)A】【水题】Vasya and Socks 妈妈买袜子 最多穿几天
- Codeforces Round #378 (Div. 2) E. Sleep in Class
- 【Codeforces Round 332 (Div 2)A】【水题】A. Patrick and Shopping 遍历三元环的最小成本
- Codeforces Round #355 (Div. 2) A. Vanya and Fence (水题)
- Codeforces Round #259 (Div. 1) A. Little Pony and Expected Maximum 数学公式结论找规律水题
- Codeforces Round #189 (Div. 1) Kalila and Dimna in the Logging Industry 斜率DP
- Codeforces Round #383 (Div. 2) A. Arpa’s hard exam and Mehrdad’s naive cheat(快速幂水题)
- Codeforces Round #384 (Div. 2) A. Vladik and flights【思维】水题