【ACM-2017四川省赛】G . 2017

该博客详细介绍了2017年四川省ACM竞赛的一道题目,要求在给定的两个整数区间内找到所有乘积能被2017整除的数对(x, y)。博主分析了因为2017是素数,所以至少有一个数是2017的倍数,并给出了两种解题方法:一种是通过计算区间内2017的倍数并减去重复项;另一种是总数减去不符合条件的数对。最后提供了AC代码供读者参考。" 53945704,1938111,Android Studio与Cordova打包APK常见问题及解决方案,"['android', 'android studio', 'cordova', 'apk', 'gradle']
摘要由CSDN通过智能技术生成

题目描述

G. 2017

Given a, b, c, d, find out the number of pairs of integers (x, y) where a ≤ x ≤ b, c ≤ y ≤ d and x · y is multiple of 2017.

Input

The input contains zero or more test cases and is terminated by end-of-file.
Each test case contains four integers a, b, c, d.
• 1 ≤ a ≤ b ≤ 109 , 1 ≤ c ≤ d ≤ 109
• The number of tests cases does not exceed 104

Output

For each case, output an integer which denotes the result.

Sample Input

1 2017 1 2016
1 1000000000 1 1000000000

Sample Output

2016
991324197233775

题意分析

从题目描述中可以很轻易的读懂(英语渣 _ ),就是给定区间 [ a , b ] , [ c , d ] , 然后分别在两个区间中各找一个数 x , y , 要求 x 属于第一个区间, y 属于第二个区间,并且 x * y 是2017的倍数。

拿到这道题目的时候其实我是很开心的,毕竟分析了下就有了思路(毕竟大家都

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值