Codeforces Round #198 (Div. 2) / 340A The Wall (数论)

自回归分布滞后模型 (ARDL)及 Stata 具体操作步骤 例如,Bahmani-Oskooee 和 Brooks(1999)研究了汇率波动与贸易收支之间的关系,发现汇率的变动在长期和短期内对贸易收支的影响存在差异,ARDL 模型能够有效地捕捉这种复杂的关系。它结合了自回归(Autoregressive,AR)模型和分布滞后(Distributed Lag,DL)模型的特点,能够同时考察变量之间的短期和长期关系。假设我们收集了一段时间内的居民消费和可支配收入数据,通过对这些数据进行分析和估计,可以得到模型的参数估计值,从而揭示消费与收入之间的短期和长期关系。 阅读详情

A. The Wall
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Iahub and his friend Floyd have started painting a wall. Iahub is painting the wall red and Floyd is painting it pink. You can consider the wall being made of a very large number of bricks, numbered 1, 2, 3 and so on.

Iahub has the following scheme of painting: he skips x - 1 consecutive bricks, then he paints the x-th one. That is, he'll paint bricks x,2·x, 3·x and so on red. Similarly, Floyd skips y - 1 consecutive bricks, then he paints the y-th one. Hence he'll paint bricks y, 2·y, 3·yand so on pink.

After painting the wall all day, the boys observed that some bricks are painted both red and pink. Iahub has a lucky number a and Floyd has a lucky number b. Boys wonder how many bricks numbered no less than a and no greater than b are painted both red and pink. This is exactly your task: compute and print the answer to the question.

Input

The input will have a single line containing four integers in this order: x, y, a, b. (1 ≤ x, y ≤ 1000, 1 ≤ a, b ≤ 2·109, a ≤ b).

Output

Output a single integer — the number of bricks numbered no less than a and no greater than b that are painted both red and pink.

Sample test(s)
input
2 3 6 18
output
3
Note

Let's look at the bricks from a to b (a = 6, b = 18). The bricks colored in red are numbered 6, 8, 10, 12, 14, 16, 18. The bricks colored in pink are numbered 6, 9, 12, 15, 18. The bricks colored in both red and pink are numbered with 6, 12 and 18.


求x,y最大公倍数的倍数在a~b范围(含)的数目。

计算f(b)-f(a-1)就行。


完整代码:

/*30ms,0KB*/

#include<cstdio>

int gcd(int a, int b)
{
	return b ? gcd(b, a % b) : a;
}

int main(void)
{
	int x, y, a, b;
	scanf("%d%d%d%d", &x, &y, &a, &b);
	int lcmxy = x * y / gcd(x, y);
	printf("%d", b / lcmxy - (a - 1) / lcmxy);
	return 0;
}

基于STM32F4XX 、HAL库的GXHT30C温湿度传感器驱动应用C语言程序设计 define GXHT30C_STATUS_WRITE_CHK (1 << 0) // 写数据校验状态。#define GXHT30C_STATUS_HUMI_TRACK (1 << 11) // 湿度跟踪报警。#define GXHT30C_STATUS_TEMP_TRACK (1 << 10) // 温度跟踪报警。#define GXHT30C_STATUS_CMD_STATUS (1 << 1) // 命令执行状态。 阅读详情

相关推荐

获取本机正版windows10激活密钥,以及正版office

本方法面向的是以前买过笔记本电脑给你预装了正版系统,激活了正版office(一般是家庭版)的情况,其他情况请自行尝试。

qq_45774917的博客 2万+

Codeforces Round #198 (Div. 2) A. The Wall

A. The Wall time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub and his friend Floyd have started painting

jjaw2013 849

Android蓝牙Mesh组网实战:从零搭建智能灯光控制系统(附完整代码)

本文详细介绍了基于Android平台开发蓝牙Mesh智能灯光控制系统的完整实战流程。从环境搭建、核心概念解析,到设备扫描配网、网络初始化、模型配置与消息通信,提供了完整的代码实现和调试技巧。重点讲解了如何使用开源Mesh库实现设备发现、分组控制、场景管理等核心功能,并分享了实际项目中遇到的典型问题与解决方案。

weixin_29174013的博客 655

杭电acm2124 Repair the Wall

Repair the Wall Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5217    Accepted Submission(s): 2506 Problem Description Long time

cwhong_723的博客 294

CodeBlocks如何将英文环境改为中文

一、下载汉化包(链接如下) 链接:https://pan.baidu.com/s/166U9WGPbJXu2hyD7q9EiJQ 提取码:2333 二、选择路径 将汉化包中的文件(CodeBlocks.mo、zh_CN.mo、zh_CN.po)放到CodeBlocks安装路径下的​​​​​​CodeBlocks/share/CodeBlocks/locale/zh_CN文件夹中,路径中的文件夹没有就新建。 注:此处需严格按照要求来,切勿自定义文件夹名 三、内部调试 打开CodeBlocks,..

云隐雾匿的博客 2万+

保姆级教程:用torch.profiler给你的vLLM推理做个“全身体检”(附Perfetto可视化分析)

本文提供了一份详细的vLLM推理性能分析教程,通过torch.profiler和Perfetto工具链实现从数据采集到可视化分析的全流程。文章涵盖了环境配置、性能数据采集、trace文件解析以及Perfetto可视化分析,帮助开发者优化大模型推理服务的性能,显著降低计算资源消耗。

weixin_29041767的博客 357

Codeforces Round #198 (Div. 2)A,B题解

Codeforces Round #198 (Div. 2) 昨天看到奋斗群的群赛,好奇的去做了一下, 大概花了3个小时Ak,我大概可以退役了吧 那下面来稍微总结一下 A. The Wall Iahub and his friend Floyd have started painting a wall. Iahub is painting the wall red and Floyd i...

weixin_30950887的博客 133

LaTeX新手入门以及TeXlive和TeXstudio的安装使用

作为一个新手,LaTeX的了解和使用很是费了一番功夫,因此,在这里给找不到路的同志们稍微介绍一下。如有错误,敬请指正。本篇内容基于Win10系统,因此安装在Mac或者Linux上的同学可以再找找其他的介绍文章。 目录 LaTeX介绍 LaTeX环境配置 一、TeXlive下载 二、TeXlive安装 1. 安装main installer 2. 正式安装 三、TeXstudio安装...

zywhehe的博客 21万+

Round #198 (Div. 2) A、The Wall

1、题目链接:http://codeforces.com/problemset/problem/340/A 2、昨晚给虐惨了,这是唯一一道做出来的,求【a,b】内的所有“x,y的最小公倍数的倍数”。注意边界可能不像样例一样是倍数,所以要处理一下,稍稍缩小范围。 3、说起来这个程序还成功躲掉一次hack呢。。。那个人hack了将近10个选手的程序,只有我这个没成功,否则这回就要爆零了。。。伤不起

365

Nuxt - 项目打包部署及上线到服务器流程(SSR 服务端渲染)

Nuxt-项目打包部署及上线到服务器流程,详细介绍Nuxt项目上线部署,服务端渲染(ssr)项目及nuxt项目部署过程,nuxt项目打包上线,Nuxt项目的部署教程,NuxtJS项目部署方案,Nuxt如何部署到线上,nuxt项目部署篇,Nuxt项目搭建到Nuxt项目部署,Nuxt项目从开始到部署,详细教程。服务器部署nuxt项目,nuxt服务端部署上线,在服务器上部署nuxt项目,NuxtJS项目——命令和部署。......

🏆 前端领域优质创作者 1万+

Vite 任意文件读取漏洞复现(CVE-2026-39363)

Vite开发服务器 WebSocket中的fetchModule方法未实施server.fs访问控制,导致攻击者可通过WebSocket连接并读取服务器上的任意文件(CVE-2026-39363)

iSee857的博客 221

Codeforces Round #198(Div. 2)A. The Wall

A. The Wall time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub and his friend Floyd have started painting

我的ACM之路。 599

国科大作业考试资料《人工智能原理与算法》2024新编-第二次作业整理

1、对于下列活动,分别给出任务环境的PEAS描述, 并按2.3.2节列出的性质进行分析: 3、为图2.2中描述的吸尘器世界实现一个可以进行性能度量的环境模拟器。你的实现是必须是模块化的,以使传感器、执行器和环境特征(大小、形状、灰尘放置等)便于修改。 4、实现上述题目真空吸尘器环境中的简单反射Agent。用所有可能的初始灰尘分布和Agent位置,运行环境模拟器和Agent。记录Agent在每种情况下的性能评分和总体平均评分。

MatsumotoChrikk 1187

Manacher 算法详解:O(n) 复杂度求最长回文子串

先预处理下:在每个字符的两边都插入一个特殊的符号,比如abba变成#a#b#b#a#,aba变成#a#b#a#(因为Manacher算法只能处理奇数长度的字符串)。同时,为了避免数组越界,在字符串开头添加另一特殊符号,比如$#a#b#a#。 以字符串3212343219为例,处理后变成S[] = "$#3#2#1#2#3#4#3#2#1#9#"。 然后用一个数组Len[i]来记录以字符S[i

AC,∑ndless 4609

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

Codeforces Round #119 (Div. 2) / 189A Cut Ribbon (完全背包)

A. Cut Ribbon http://codeforces.com/problemset/problem/189/A time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output

AC,∑ndless 2675

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

Codeforces Round #105 (Div. 2) / 148A Insomnia cure (枚举 || 数论)

A. Insomnia cure http://codeforces.com/problemset/problem/148/A time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output

AC,∑ndless 2453

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

Codeforces Beta Round #74 (Div. 2) / 90B African Crossword (模拟)

B. African Crossword http://codeforces.com/problemset/problem/90%2FB time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard o

AC,∑ndless 2416

Codeforces Round #173 (Div. 2) / 282A Bit++(模拟)

A. Bit++ http://codeforces.com/problemset/problem/282/A time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output

AC,∑ndless 2227

Codeforces Round #235 (Div. 2) / 410D Roman and Numbers (带有整除性质的数位DP)

http://codeforces.com/problemset/problem/401/D 解释全部在代码的注释中: /*78ms,205464KB*/ #include using namespace std; const int mx = 1 << 18; long long dp[mx][100]; ///dp[mask][j]表示余数为j时的mask对应的x的个数 ///

AC,∑ndless 2198

Codeforces Round #194 (Div. 1) / 333A Secrets(贪心)

A. Secrets http://codeforces.com/contest/333/problem/A time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Ge

AC,∑ndless 2041

Codeforces Beta Round #98 (Div. 2) / 137A Postcards and photos (模拟)

A. Postcards and photos http://codeforces.com/problemset/problem/137/A time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard

AC,∑ndless 2022

Codeforces Round #177 (Div. 1) / 288A Polo the Penguin and Strings(贪心)

A. Polo the Penguin and Strings http://codeforces.com/problemset/problem/288/A time limit per test 2 seconds memory limit per test 256 megabytes input standard input output

AC,∑ndless 1932

Codeforces Beta Round #75 (Div. 2) / 92B Binary Number(贪心)

B. Binary Number http://codeforces.com/problemset/problem/92/B time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output

AC,∑ndless 1931

Codeforces Round #183 (Div. 1) / 303A Lucky Permutation Triple (强大的数学&想法题)

http://codeforces.com/problemset/problem/303/A when n is odd, A[i] = B[i] = i when n is even, there is no solution. why? If , then  or just , where S = 0 + 1 + ... + n - 1 = n(n - 1) / 

AC,∑ndless 1915

Codeforces Round #237 (Div. 2) / 404C Restore Graph (构造最短路径树)

http://codeforces.com/contest/404/problem/C 思路:我们构造一颗最短路径树就行了。 若能够构造,边数必然为n-1(样例1的边数可以是两条)。 如何构造?从距离为1的点开始,逐渐往下加边,生成一颗k叉树。若在中间生成了大于k的叉,则输出-1。 完整代码: /*265ms,4436KB*/ #include using namesp

AC,∑ndless 1840

Codeforces Round #186 (Div. 2) / 313B Ilya and Queries (字符串处理)

B. Ilya and Queries time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ilya the Lion wants to help all his fri

AC,∑ndless 1810
上一篇: URAL 1915 Titan Ruins: Reconstruction of Bygones (栈)
下一篇: UVa 1513 / UVALive 5902 Movie collection (树状数组)
synapse7
博客等级 码龄14年 432粉丝 701原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值