Codeforces 659A Round House【水题,细节】
题目链接:
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【水题,细节】的更多相关文章
- codeforces 659A A. Round House(水题)
题目链接: A. Round House time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Gym 100531G Grave 水题
Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...
- codeforces 706A A. Beru-taxi(水题)
题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...
- codeforces 569B B. Inventory(水题)
题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces 489A SwapSort (水题)
A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
- codeforces 688A A. Opponents(水题)
题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- 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 ...
- A. Arrays(Codeforces Round #317 水题)
A. Arrays time limit per test 2 seconds memory limit per test 256 megabytes input standard input out ...
- CodeForces 534B Covered Path (水题)
题意:给定两个速度,一个一初速度,一个末速度,然后给定 t 秒时间,还每秒速度最多变化多少,让你求最长距离. 析:其实这个题很水的,看一遍就知道怎么做了,很明显就是先从末速度开始算起,然后倒着推. 代 ...
随机推荐
- 如何配置TomCat
1.先查看你自己java的jdk的版本号 2.通过jdk版本号确定下载的Tomcat版本 ,因为我的是jdk 1.8的,所以要下载Tomcat 8版本 附上下载官网http://tomcat.apac ...
- 如何正确理解和使用 Activity的4种启动模式
关于Activity启动模式的文章已经很多,但有的文章写得过于简单,有的则过于注重细节,本文想取一个折中,只关注最重要和最常用的概念,原理和使用方法,便于读者正确应用. Activity的启动模式有4 ...
- vue路由导航守卫及前置后置钩子函数参数详解
首先构建一个测试demo如下图: 接着来探讨路由配置界面 import Vue from 'vue' import Router from 'vue-router' // import HelloWo ...
- 借助tween.js小球沿div四边跑的动画效果
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'needDao' defined in URL
这个是我修改过后的mapper,是我的mapper中的空间地址写错了呢
- scriptPubKey and scriptSig
First of all two matching scripts are used in two different transactions, one that transfers funds t ...
- HDU 5768Lucky7(多校第四场)容斥+中国剩余定理(扩展欧几里德求逆元的)+快速乘法
地址:http://acm.hdu.edu.cn/showproblem.php?pid=5768 Lucky7 Time Limit: 2000/1000 MS (Java/Others) M ...
- docker 容器的网络
容器的网络模式 bridge -net=bridge 默认网络.docker启动后创建一个docker0网桥,默认创建的容器也添加到这个网桥 [root@localhost ~]# ip a 1: l ...
- 从postgres数据库逆向生成hibernate实体类
最近整理 一个项目,原先的项目是用的oracle,然而新的项目要用postgresql.将oracle数据库导出之后,通过powerdesigner整理,导出postgresql的脚本,然后在post ...
- python之range (范围)
例题: for i in range(10): print(i,end='') # 输出结果 0123456789 # s = range(1,10) # 面试大坑 python2 和 python3 ...