题目链接:

A. Round House

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Vasya lives in a round building, whose entrances are numbered sequentially by integers from 1 to n. Entrance n and entrance 1 are adjacent.

Today Vasya got bored and decided to take a walk in the yard. Vasya lives in entrance a and he decided that during his walk he will move around the house b entrances in the direction of increasing numbers (in this order entrance n should be followed by entrance 1). The negative value of b corresponds to moving |b| entrances in the order of decreasing numbers (in this order entrance 1 is followed by entrance n). If b = 0, then Vasya prefers to walk beside his entrance.

Illustration for n = 6, a = 2, b =  - 5.

Help Vasya to determine the number of the entrance, near which he will be at the end of his walk.

Input

The single line of the input contains three space-separated integers na and b (1 ≤ n ≤ 100, 1 ≤ a ≤ n,  - 100 ≤ b ≤ 100) — the number of entrances at Vasya's place, the number of his entrance and the length of his walk, respectively.

Output

Print a single integer k (1 ≤ k ≤ n) — the number of the entrance where Vasya will be at the end of his walk.

Examples
input
6 2 -5
output
3
input
5 1 3
output
4
input
3 2 7
output
3
Note

The first example is illustrated by the picture in the statements.

题意:

n个entrances a为起点,b为步数,问最终在哪,b正是一个方向,负是一个方向;

思路:

水题,不想解释,居然最后挂在了system test 上;

AC代码:

/*
2014300227 659A - 49 GNU C++11 Accepted 15 ms 2172 KB */
#include <bits/stdc++.h>
using namespace std;
int a[];
int main()
{
int n,a,b;
scanf("%d%d%d",&n,&a,&b);
queue<int>qu;
int cnt=;
if(b>)
{
for(int i=a;i<=n;i++)
{
qu.push(i);
}
for(int i=;i<a;i++)
{
qu.push(i);
}
while()
{
qu.push(qu.front());
qu.pop();
cnt++;
if(cnt>=b)
{
cout<<qu.front()<<endl;
break;
}
} }
else if(b<)
{
b=-b;
for(int i=a;i>;i--)
{
qu.push(i);
}
for(int i=n;i>a;i--)
{
qu.push(i);
}
while()
{
qu.push(qu.front());
qu.pop();
cnt++;
if(cnt>=b)
{
cout<<qu.front()<<endl;
break;
}
} }
else
{
cout<<a<<endl;
} return ;
}

codeforces 659A A. Round House(水题)的更多相关文章

  1. codeforces 577B B. Modulo Sum(水题)

    题目链接: B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  2. codeforces 696A Lorenzo Von Matterhorn 水题

    这题一眼看就是水题,map随便计 然后我之所以发这个题解,是因为我用了log2()这个函数判断在哪一层 我只能说我真是太傻逼了,这个函数以前听人说有精度问题,还慢,为了图快用的,没想到被坑惨了,以后尽 ...

  3. CodeForces 589I Lottery (暴力,水题)

    题意:给定 n 和 k,然后是 n 个数,表示1-k的一个值,问你修改最少的数,使得所有的1-k的数目都等于n/k. 析:水题,只要用每个数减去n/k,然后取模,加起来除以2,就ok了. 代码如下: ...

  4. Codeforces Gym 100286G Giant Screen 水题

    Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...

  5. codeforces 710A A. King Moves(水题)

    题目链接: A. King Moves 题意: 给出king的位置,问有几个可移动的位置; 思路: 水题,没有思路; AC代码: #include <iostream> #include ...

  6. CodeForces 489B BerSU Ball (水题 双指针)

    B. BerSU Ball time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  7. codeforces 702A A. Maximum Increase(水题)

    题目链接: A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input sta ...

  8. Codeforces Round #346 (Div. 2) A. Round House 水题

    A. Round House 题目连接: http://www.codeforces.com/contest/659/problem/A Description Vasya lives in a ro ...

  9. A. Arrays(Codeforces Round #317 水题)

    A. Arrays time limit per test 2 seconds memory limit per test 256 megabytes input standard input out ...

随机推荐

  1. Build Your Jekyll Blog (On Github)

    http://kevinjmh.github.io/web/2014/04/20/build-your-jekyll-blog/ 20 April 2014 On GitHub Follow the ...

  2. hdu 2602 - Bone Collector(01背包)解题报告

    Bone Collector Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) T ...

  3. AMD和Intel的CPU对比

    http://www.lotpc.com/yjzs/5825.html 推荐文章:小白看AMD与intel的cpu架构,AMD慢的原因 CPU核心的发展方向是更低的电压.更低的功耗.更先进的制造工艺. ...

  4. Nginx绑定多个域名的方法

        nginx绑定多个域名可又把多个域名规则写一个配置文件里,也可又分别建立多个域名配置文件,我一般为了管理方便,每个域名建一个文件,有些同类域名也可又写在一个总的配置文件里.  一.每个域名一个 ...

  5. OpenCV视频读取播放,视频转换为图片

    转载请注明出处!!! http://blog.csdn.net/zhonghuan1992 OpenCV视频读取播放,视频转换为图片 介绍几个有关视频读取的函数: VideoCapture::Vide ...

  6. IE8 "开发人员工具" 无法使用,无法显示

    经常使用IE8开发工具的开发人员可能会遇到这么一种去情况:按F12时任务栏里出现开发人员工具的任务,但是开发人员工具窗体不弹出,也不出现在IE8里,重装IE88后还是存在此问题. 解决办法其实非常简单 ...

  7. Rate Monotonic Scheduling algorithm

    这篇文章写得不错 http://barrgroup.com/embedded-systems/How-To/RMA-Rate-Monotonic-Algorithm 另外rtems的官方文档也有类似说 ...

  8. PLSQL怎样导出oracle表结构

    tools->export tables 是导出表结构还有数据 tools->export user objects是导出表结构   可以用tools->export tables ...

  9. 【Linux】OpenWRT的无线设置注意事项——从2.4G到5G,hwmode不简单

    硬件说明: 操作系统:OpenWRT 网卡:AR9220R52Hn 网卡驱动:ath9k OpenWRT在刷机完成之后,并不会自动开启无线功能,需要手动修改配置文件,然后重启网络服务.管理无线功能的配 ...

  10. 讲真,你是因为什么才买华为P20系列手机!

    华为P20系列手机上市两个半月发货600万台!600万台?!看到这个亮瞎我钛合金狗眼的数据,且容我掰着手指脚趾算一下,算了,还是容我毫不夸张的感叹一句吧:华为做手机不用桨,不需风,全靠“浪”……. 两 ...