题目链接:

http://codeforces.com/contest/659/problem/A

题意:

一个圈,按逆时针编号,给定起点,方向和步数,问终点在几号?

分析:

很简单的模拟。。。注意答案为0的时候应该输出n。。。

代码:

#include<iostream>
using namespace std;
int main (void)
{
int n, a, b;cin>>n>>a>>b;
b = (b - 1) %n + 1;
int k = (a - 1 + b + n)%n + 1 ;
if(k) cout<<k<<endl;
else cout<<n<<endl;
}

Codeforces 659A Round House【水题,细节】的更多相关文章

  1. codeforces 659A A. Round House(水题)

    题目链接: A. Round House time limit per test 1 second memory limit per test 256 megabytes input standard ...

  2. Codeforces Gym 100531G Grave 水题

    Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...

  3. codeforces 706A A. Beru-taxi(水题)

    题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...

  4. codeforces 569B B. Inventory(水题)

    题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  5. Codeforces 489A SwapSort (水题)

    A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...

  6. codeforces 688A A. Opponents(水题)

    题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...

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

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

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

  9. CodeForces 534B Covered Path (水题)

    题意:给定两个速度,一个一初速度,一个末速度,然后给定 t 秒时间,还每秒速度最多变化多少,让你求最长距离. 析:其实这个题很水的,看一遍就知道怎么做了,很明显就是先从末速度开始算起,然后倒着推. 代 ...

随机推荐

  1. FPGA内部RAM的初始化

    Altera的RAM初始化文件格式是mif和hex. QuartusII自带的RAM初始化工具很方便产生初始化文件. Xilinx的RAM初始化文件格式是coe, 在vivado中软件会将coe文件变 ...

  2. 李开复:AlphaGo 若打败了世界冠军,意味着什么?

    创新工场董事长李开复在知乎就AlphaGo与李世石的人机大战发表了自己看法,他认为四个月前的AlphaGo击败李世石基本不可能,不过这四个月AlphaGo进步很多,比赛应该很精彩.但是,无论这次结果如 ...

  3. (转)编码剖析Spring依赖注入的原理

    http://blog.csdn.net/yerenyuan_pku/article/details/52834561 Spring的依赖注入 前面我们就已经讲过所谓依赖注入就是指:在运行期,由外部容 ...

  4. linux之awk命令

    一.awk的内置参数 $0:表示整个当前行 $1:每行第一个字段 $2:每行第二个字段 $n:每行第n个字段 awk的参数:分隔符 -F separator 设定分隔符(默认为空格) 打印单个字段: ...

  5. Image Is Everything LA2995

    白书第一章例题6 构造.思维.几何. 分别从几个角度去看,有矛盾就删掉,最后遍历一下统计个数 方法证明:第一个方块肯定要删除.假设前k个必须删除,第k+1个矛盾出现,假如不删掉,矛盾将持续存在,故必须 ...

  6. 通过JS加载XML文件,跨浏览器兼容

    引言 通过JS加载XML文件,跨多种浏览器兼容. 在Chrome中,没有load方法,需要特殊处理! 解决方案 部分代码 try //Internet Explorer { xmlDoc=new Ac ...

  7. k8s集群之master节点部署

    apiserver的部署 api-server的部署脚本 [root@mast-1 k8s]# cat apiserver.sh #!/bin/bash MASTER_ADDRESS=$1 主节点IP ...

  8. 暑假集训 || AC自动机

    HDU 2222 题意:给n个模式串和一个字符串,求有多少个模式串在这个字符串中出现 思路:裸题,注意数组开的大小 #include <iostream> #include <cst ...

  9. 假设在一个 32 位 little endian 的机器上运行下面的程序,结果是多少?

    假设在一个 32 位 little endian 的机器上运行下面的程序,结果是多少? #include <stdio.h> int main(){ , b = , c = ; print ...

  10. 896. Monotonic Array@python

    An array is monotonic if it is either monotone increasing or monotone decreasing. An array A is mono ...