福大程序在线评测系统 Problem 1992 An Easy Problem 怎么解?
来源:学生作业帮 编辑:百度作业网作业帮 分类:综合作业 时间:2024/07/07 18:08:08
福大程序在线评测系统 Problem 1992 An Easy Problem 怎么解?
In mathematics, “MOD” operation is common. C = A (MOD B), which means that the
remainder of A after divided by B is equal to that of C. It’s an easy problem to
test whether A and C satisfy the condition above. But what you are expected to
is not so easy! You will be given A and C and to find the number of B who
satisfies the condition (equation) above, you could assume that A is not equal
to C in this problem.
输入
A=9,C=3
为什么结果是B=4
问题网址链接:http://acm.fzu.edu.cn/problem.php?pid=1992
In mathematics, “MOD” operation is common. C = A (MOD B), which means that the
remainder of A after divided by B is equal to that of C. It’s an easy problem to
test whether A and C satisfy the condition above. But what you are expected to
is not so easy! You will be given A and C and to find the number of B who
satisfies the condition (equation) above, you could assume that A is not equal
to C in this problem.
输入
A=9,C=3
为什么结果是B=4
问题网址链接:http://acm.fzu.edu.cn/problem.php?pid=1992
解法也很简单,因为模b余数相同,则可以设a = k1 * b + d,c = k2 * b + d a-c = (k1-k2)*b; 所以b是(a-c)的一个因数,答案就是(a-c)的因子数;
#include
#include
#include
using namespace std;
int main()
{
int a,c,total,t,tmp,cs = 0;
scanf("%d",&t);
while( t-- )
{
total = 0;
scanf("%d%d",&a,&c);
tmp = a > c a-c :c - a;
for(int i=1;i*i
#include
#include
#include
using namespace std;
int main()
{
int a,c,total,t,tmp,cs = 0;
scanf("%d",&t);
while( t-- )
{
total = 0;
scanf("%d%d",&a,&c);
tmp = a > c a-c :c - a;
for(int i=1;i*i
福大程序在线评测系统 Problem 1992 An Easy Problem 怎么解?
an easy english problem
An easy problem about C++
An easy English problem,高手进
Easy English problem
english problem[easy]
{{..Easy的Maths problem..]]
problem
an environmental problem in
An English problem
HELP! An English problem!
An important English problem