• 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
    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.

    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 nm 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.

    模拟题,随便乱搞。

     1 #include<iostream>
     2 #include<cstdio>
     3 #include<algorithm>
     4 #include<cstring>
     5 #include<queue>
     6 using namespace std;
     7 const int mxn=100010;
     8 int read(){
     9     int x=0,f=1;char ch=getchar();
    10     while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    11     while(ch>='0' && ch<='9'){x=x*10-'0'+ch;ch=getchar();}
    12     return x*f;
    13 }
    14 int n,m,k;
    15 int main(){
    16     int i,j;
    17     n=read();m=read();k=read();
    18     int tmp=(k+1)/2;
    19     int p=(tmp+m-1)/m;
    20     int s=(tmp)%m;
    21     if(!s)s=m;
    22     cout<<p<<" "<<s<<" ";
    23     if(k&1)printf("L
    ");
    24     else printf("R
    ");
    25     return 0;
    26 }
  • 相关阅读:
    SQL Server 2005 上安装SQL Server Management Studio
    小心博客被Google点名为有恶意软件
    新文章尚邮使用评论 ,包含Gmail的设置以及存在的一些问题
    发布一小软件
    在 ASP.NET 上实现锁定表头、支持滚动的表格的做法
    怎样检测网络中的电脑是否有安装SQL 2000
    危险字符过滤的类
    通过避免下列 10 个常见 ASP.NET 缺陷使网站平稳运行(转载)
    javascript控制页面控件隐藏显示的两种方法
    整理的一些Tsql(二)
  • 原文地址:https://www.cnblogs.com/SilverNebula/p/6224280.html
Copyright © 2020-2023  润新知