链接: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;elsecout << "NO" << endl;return 0;
}

  

转载于:https://www.cnblogs.com/YDDDD/p/10930192.html

Codeforces Round #562 (Div. 2) A.Circle Metro相关推荐

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

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

  2. [CF]Codeforces Round #529 (Div. 3)

    [CF]Codeforces Round #529 (Div. 3) C. Powers Of Two Description A positive integer xx is called a po ...

  3. Codeforces Round #801 (Div. 2)A~C

    Codeforces Round #801 (Div. 2)A~C Problem - A - Codeforces Michael and Joe are playing a game. The g ...

  4. Codeforces Round #506 (Div. 3)

    Codeforces Round #506 (Div. 3) 实习期间事不多,对div3 面向题解和数据编程了一波 A. Many Equal Substrings 题目链接 A题就是找后缀和前缀重合 ...

  5. Codeforces Round #563 (Div. 2)/CF1174

    Codeforces Round #563 (Div. 2)/CF1174 CF1174A Ehab Fails to Be Thanos 其实就是要\(\sum\limits_{i=1}^n a_i ...

  6. 构造 Codeforces Round #302 (Div. 2) B Sea and Islands

    题目传送门 1 /* 2 题意:在n^n的海洋里是否有k块陆地 3 构造算法:按奇偶性来判断,k小于等于所有点数的一半,交叉输出L/S 4 输出完k个L后,之后全部输出S:) 5 5 10 的例子可以 ...

  7. Codeforces Round #696 (Div. 2) (A ~ E)超高质量题解(每日训练 Day.16 )

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 Codeforces Round #696 (Div. 2) (A ~ E)超高质量题解 比赛链接:h ...

  8. Codeforces Round #712 Div.2(A ~ F) 超高质量题解(每日训练 Day.15 )

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 Codeforces Round #712 Div.2(A ~ F) 题解 比赛链接:https:// ...

  9. Codeforces Round #701 (Div. 2) A ~ F ,6题全,超高质量良心题解【每日亿题】2021/2/13

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 目录 A - Add and Divide B - Replace and Keep Sorted C ...

最新文章

  1. python excel 自动化-Python控制Excel实现自动化办公
  2. emacs python开发环境_配置Emacs下的Python开发环境
  3. 密码技术--国密证书及go语言生成自签国密证书
  4. LINQ系列:LINQ to ADO.NET概述
  5. Ipython 和 python 的区别
  6. 10-排序4 统计工龄 (20 分)
  7. 分布式事务框架_阿里分布式事务框架GTS开源啦!
  8. 美团点评移动网络优化实践
  9. Docker 安装(学习笔记一)
  10. jsp进阶教程和Servlet
  11. 华景机器人百度_qq群机器人凉了,晨风创始人被抓,酷Q停止运营!
  12. excel表格打印每页都有表头_Excel打印时如何实现每一页纸上都有表头?
  13. 国际商务英语学习[三]
  14. QT字符文字转换语音播放
  15. chroot用法详解
  16. 解决出行难题,共享巴士小程序开发
  17. 教程:用强化学习玩转恐龙跳跳
  18. 【技术整合】各技术解决方案与对应解决的问题
  19. vue 海康视频播放
  20. 网络安全常用的工具有哪些(二)

热门文章

  1. idea社区版配置web项目
  2. 山东师范大学计算机专业几本,山东师范大学属于几本
  3. 线程池 掌握治理线程的法宝
  4. ContextConnection的子类FileConnection,HttpConnection
  5. ubuntu的常用命令--Day1
  6. 基于磁场数据侧信道分析的应用识别技术
  7. 计算机屏幕出现条纹w7,电脑屏幕出现条纹,教您win10屏幕出现条纹的解决方法
  8. RAID5的配置流程及模拟硬盘损坏
  9. 回波数据adc_data.bin解析(附MATLAB程序)
  10. Hive常见查询操作与函数汇总