当前位置:网站首页>HDU1573 X问题【一元线性同余方程组】
HDU1573 X问题【一元线性同余方程组】
2022-07-27 16:40:00 【51CTO】
题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=1573
题目大意:
求在小于等于N的正整数中有多少个X满足:X mod a[0] = b[0], X mod a[1] = b[1], X mod a[2] = b[2],
…, X mod a[i] = b[i], … (0 < a[i] <= 10)。
思路:
先求出数组b[]中所有数的最小公倍数lcm,再求解出该一元线性同余方程组在lcm范围内的解为a,题目要
求解x是小于等于N的正整数,则可列不等式:a + lcm * x <= N。那么,如果a = 0,则答案为x-1,如果
a != 0,则答案为x。
AC代码:
边栏推荐
- Kinect2 for unity3d - avatardemo learning
- 「测试新手百科」5 分钟快速上手Pytest 自动化测试框架
- Error analysis of building Alibaba cloud +typera+picgo map bed
- 内存管理A4
- C interface knowledge collection suggestions collection
- An experience
- 利用 Fastjson json (简单粗暴版)
- Win10 tips (1) -- transfer desktop location
- Unity学习笔记(刚体-物理-碰撞器-触发器)
- Rename file with command line
猜你喜欢

ipfs通过接口获得公钥、私钥,并加密存储。第一弹

C language case: password setting and login > clear solution getchar and scanf

Win10 tips (1) -- transfer desktop location

搭建阿里云+typora+Picgo图床错误分析

kettle 合并记录 数据减少

Performance analysis of continuous time system (1) - performance index and first and second order analysis of control system

Automatic testing of Web UI: Selenium syntax explanation is the most complete in the history

每日一题(02):倒置字符串

200行代码快速入门文档型数据库MonogoDB

Express get/post/delete... Request
随机推荐
编程式跳转
C # one method returns multiple values. Suggestions collection
收下这份实操案例,还怕不会用Jmeter接口测试工具
There is another example of repeater
MongoDB
Nacos基本概念和单机部署
The great idea of NS2
Greedy method, matroid and submodular function (refer)
大冤种们,新进测试行业,如何正确选择意向企业?
Webmagic+selenium+chromedriver+jdbc grabs data vertically.
MySQL learning notes (1) -- variables
C语言案例:密码设置及登录> 明解getchar与scanf
ref 关键字的用法
Power control
I'm afraid I won't use the JMeter interface testing tool if I accept this practical case
express
自控原理学习笔记-系统稳定性分析(2)-环路分析及Nyquist-Bode判据
kettle JVM内存设置---效果不明显
Latex use - subfigure vertical graphics
Kettle learning - the repository configuration in version 8.2 is grayed out, and there is no connect button