Codeforces Round #562 (Div. 2) A.Circle Metro
链接:https://codeforces.com/contest/1169/problem/A
题意:
The circle line of the Roflanpolis subway has nn stations.
There are two parallel routes in the subway. The first one visits stations in order 1→2→…→n→1→2→…1→2→…→n→1→2→… (so the next stop after station xx is equal to (x+1)(x+1) if x<nx<n and 11 otherwise). The second route visits stations in order n→(n−1)→…→1→n→(n−1)→…n→(n−1)→…→1→n→(n−1)→… (so the next stop after station xx is equal to (x−1)(x−1) if x>1x>1 and nn otherwise). All trains depart their stations simultaneously, and it takes exactly 11 minute to arrive at the next station.
Two toads live in this city, their names are Daniel and Vlad.
Daniel is currently in a train of the first route at station aa and will exit the subway when his train reaches station xx.
Coincidentally, Vlad is currently in a train of the second route at station bb and he will exit the subway when his train reaches station yy.
Surprisingly, all numbers a,x,b,ya,x,b,y are distinct.
Toad Ilya asks you to check if Daniel and Vlad will ever be at the same station at the same time during their journey. In other words, check if there is a moment when their trains stop at the same station. Note that this includes the moments when Daniel or Vlad enter or leave the subway.
思路:
暴力
代码:
#include <bits/stdc++.h> using namespace std; typedef long long LL;
const int MAXN = 1e5 + 10;
const int MOD = 1e9 + 7;
int n, m, k, t;
int p, q, u, v;
int x, y, z, w;
int a, b; int main()
{
cin >> n >> a >> x >> b >> y;
bool flag = false;
int len = 2*n;
while(len--)
{
a++;
if (a > n)
a = 1;
b--;
if (b < 1)
b = n;
if (a == b)
flag = true;
if (a == x || b == y)
break;
}
if (flag)
cout << "YES" << endl;
else
cout << "NO" << endl; return 0;
}
Codeforces Round #562 (Div. 2) A.Circle Metro的更多相关文章
- [Done] Codeforces Round #562 (Div. 2) 题解
A - Circle Metro 模拟几百步就可以了. B - Pairs 爆搜一下,时间复杂度大概是 $O(4 * n)$ Code: 56306723 C - Increasing by Modu ...
- Codeforces Round #562 (Div. 2) C. Increasing by Modulo
链接:https://codeforces.com/contest/1169/problem/C 题意: Toad Zitz has an array of integers, each intege ...
- Codeforces Round #562 (Div. 2) B. Pairs
链接:https://codeforces.com/contest/1169/problem/B 题意: Toad Ivan has mm pairs of integers, each intege ...
- Codeforces Round #418 (Div. 2) D. An overnight dance in discotheque
Codeforces Round #418 (Div. 2) D. An overnight dance in discotheque 题意: 给\(n(n <= 1000)\)个圆,圆与圆之间 ...
- Codeforces Round #579 (Div. 3)
Codeforces Round #579 (Div. 3) 传送门 A. Circle of Students 这题我是直接把正序.逆序的两种放在数组里面直接判断. Code #include &l ...
- Codeforces Round #564 (Div. 1)
Codeforces Round #564 (Div. 1) A Nauuo and Cards 首先如果牌库中最后的牌是\(1,2,\cdots, k\),那么就模拟一下能不能每次打出第\(k+i\ ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
随机推荐
- matlab之scatter3()函数
Display point cloud in scatter plot(在散点图中显示点云): scatter3(X,Y,Z) 在向量 X.Y 和 Z 指定的位置显示圆圈. scatter3(X,Y, ...
- db2move 数据导出整理
db2move <database-name> <action> [<option> <value>] 命令解释:1).database-name, ...
- IDEAL葵花宝典:java代码开发规范插件 lombok 插件
前言: lombok简介: lombok是暑假来到公司实习的时候发现的一个非常好用的小工具,刚见到的时候就感觉非常惊艳,有一种相见恨晚的感觉,用了一段时间之后感觉的确挺不错,所以特此来推荐一下. 那么 ...
- 练习E-R图书管理数据库
- storm源码剖析(3):topology启动过程
storm的topology启动过程是执行strom jar topology1.jar MAINCLASS ARG1 ARG2 鉴于前面已经分析了脚本的解析过程,现在重点分析topology1.ja ...
- 「USACO15FEB」「LuoguP3121」审查(黄金)Censoring (Gold)(AC自动机
题目描述 Farmer John has purchased a subscription to Good Hooveskeeping magazine for his cows, so they h ...
- Django简单快速实现PUT、DELETE方法
使用django的小伙伴们应该都知道我们是无法开心的处理PUT跟DELETE的 $.ajax({ url: 'XXX', type: 'PUT', dataType: 'json', data: { ...
- Moco框架jar下载地址
1.打开url:http://repo1.maven.org/maven2/com/github/dreamhead/moco-runner/0.10.0/ 2.下载最大的jar包,如下图所示:
- AAAAAA
有可能被立案调查.暂停上市.退市风险警示*ST.特别处理ST的公司:银鸽投资(SH:600069).天山生物(SZ:300313).金贵银业(SZ:002716).美盛文化(SZ:002699).未名 ...
- C++读取XML,tinyXml的使用
前言: 最近在开发的过程中,有个需求是对xml进行格式转化,从一种格式转化到另外一种格式.因此,就需要读取xml进行处理.原本打算写成工具在linux下运行,不过后来考虑到和系统结合,最后也就使用了前 ...