链接: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的更多相关文章

  1. [Done] Codeforces Round #562 (Div. 2) 题解

    A - Circle Metro 模拟几百步就可以了. B - Pairs 爆搜一下,时间复杂度大概是 $O(4 * n)$ Code: 56306723 C - Increasing by Modu ...

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

  3. Codeforces Round #562 (Div. 2) B. Pairs

    链接:https://codeforces.com/contest/1169/problem/B 题意: Toad Ivan has mm pairs of integers, each intege ...

  4. 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)\)个圆,圆与圆之间 ...

  5. Codeforces Round #579 (Div. 3)

    Codeforces Round #579 (Div. 3) 传送门 A. Circle of Students 这题我是直接把正序.逆序的两种放在数组里面直接判断. Code #include &l ...

  6. Codeforces Round #564 (Div. 1)

    Codeforces Round #564 (Div. 1) A Nauuo and Cards 首先如果牌库中最后的牌是\(1,2,\cdots, k\),那么就模拟一下能不能每次打出第\(k+i\ ...

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

  8. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

  9. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

随机推荐

  1. Mac安装 Storm 小结

    Strom 安装&部署 本地执行:Storm Topology是可进行本地运行的, 必须在发布前进行本地测试, 以确保代码本身业务逻辑没有问题( Windows也可执行, 但是由于权限等原因, ...

  2. 轻量级RPC框架开发

    nio和传统io之间工作机制的差别 自定义rpc框架的设计思路 rpc框架的代码运行流程 第2天 轻量级RPC框架开发 今天内容安排: 1.掌握RPC原理 2.掌握nio操作 3.掌握netty简单的 ...

  3. php设计模式课程---5、责任链模式是什么

    php设计模式课程---5.责任链模式是什么 一.总结 一句话总结: 自己权限不够,就交给上级处理 1.选择结构怎么做到面向对象开闭原则? 也就是说if,都可以用接口的实现来实现,这样就避免了更新的时 ...

  4. 前端多媒体(4)—— video标签全面分析

    测试地址:https://young-cowboy.github.io/gallery/html5_video/index.html 属性 一些属性是只读的,一些属性是可以修改从而影响视频播放的. a ...

  5. oracle Instant Client install

    Installation See the Instant Client Home Page for more information. Installation of ZIP files: 1. Do ...

  6. ACM学习历程——HDU2227 Find the nondecreasing subsequences(线段树 && dp)

    Description How many nondecreasing subsequences can you find in the sequence S = {s1, s2, s3, ...., ...

  7. Jmeter提取响应数据的结果保存到本地的一个文件

    原文地址: https://www.cnblogs.com/whitewasher/p/9504728.html 当做性能压测时,可能会需要把响应数据的一些字段统计出来.这里简单介绍一下. 1.首先把 ...

  8. va_list函数学习

    当你的函数的参数个数不确定时,就可以使用上述宏进行动态处理,这无疑为你的程序增加了灵活性. va_list的使用方法: a)  首先在函数中定义一个具有va_list型的变量,这个变量是指向参数的指针 ...

  9. Fluuter常遇到的问题

    The ADB binary found at XX is obsolete and has seriousperformance problems with the Android Emulator ...

  10. 2-6 Flutter开发环境与Android开发环境设置实操(Windows)

    通常安装完AS后,sdk的目录 C:\Users\wjw\AppData\Local\Android\sdk 如果在这个目录下没有找到sdk的目录的话 Settings里面搜索sdk,找到Androi ...