A. Santa Claus and a Place in a Class
2017-05-06 16:46
344 查看
PROBLEMS
SUBMIT
STATUS
STANDINGS
CUSTOM
TEST
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.
![](http://codeforces.com/predownloaded/be/22/be22cf2145650e53ec680c6c6808cd4444124fd3.png)
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.
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int main()
{
int l,h,n;
while(cin>>l>>h>>n){
for(int i=0;i<=l;i++){
if(i*2*h+1<=n&&(i+1)*2*h>=n){
int ll=i+1;
int yu=n-i*2*h;
if(yu%2==1){
cout<<ll<<" "<<yu/2+1<<" "<<"L"<<endl;
}
else
cout<<ll<<" "<<yu/2<<" "<<"R"<<endl;
}
}
}
return 0;
}
PROBLEMS
SUBMIT
STATUS
STANDINGS
CUSTOM
TEST
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.
![](http://codeforces.com/predownloaded/be/22/be22cf2145650e53ec680c6c6808cd4444124fd3.png)
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.
SUBMIT
STATUS
STANDINGS
CUSTOM
TEST
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.
![](http://codeforces.com/predownloaded/be/22/be22cf2145650e53ec680c6c6808cd4444124fd3.png)
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 <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
int main()
{
int l,h,n;
while(cin>>l>>h>>n){
for(int i=0;i<=l;i++){
if(i*2*h+1<=n&&(i+1)*2*h>=n){
int ll=i+1;
int yu=n-i*2*h;
if(yu%2==1){
cout<<ll<<" "<<yu/2+1<<" "<<"L"<<endl;
}
else
cout<<ll<<" "<<yu/2<<" "<<"R"<<endl;
}
}
}
return 0;
}
PROBLEMS
SUBMIT
STATUS
STANDINGS
CUSTOM
TEST
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.
![](http://codeforces.com/predownloaded/be/22/be22cf2145650e53ec680c6c6808cd4444124fd3.png)
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.
相关文章推荐
- Codeforces 748A-Santa Claus and a Place in a Class
- Santa Claus and a Place in a Class (Codeforces-748A)
- 【Codeforces Round #389】Codeforces 752A Santa Claus and a Place in a Class
- 【codeforces 748A】Santa Claus and a Place in a Class
- Codeforces Round #389 (Div. 2)A. Santa Claus and a Place in a Class(水题)
- CF # 389 Santa Claus and a Place in a Class
- A. Santa Claus and a Place in a Class
- 【codeforces 752A】Santa Claus and a Place in a Class
- 748 A. Santa Claus and a Place in a Class codeforces
- Codeforces Round #389 Div.2 A. Santa Claus and a Place in a Class
- How to place all WPF commands and related events centrally in a static class
- AutoScrollManager Class: Scroll scrollbar when mouse is moving in a specified area and mouse button is down
- 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
- I did an SDK update last night and it moved adb.exe. In its place it left a file called "adb_has_mov
- 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