把1316这个数表示成两个数的和,其中一个为13的倍数,另一个是11的倍数,求这两个数。
算法分析:
1316,显然1300是13的倍数,但16不是11的倍数,可以想到从1300上任意减去N个13的倍数其结果仍然是13的倍数,那么只要16加上这个减去的N个13的倍数其和是11的倍数,这两个数就解出来了,答案可能不只一个,但是我们只求一对解就可以了。
仔细观察不难发现:(16+13*3)+(1300-13*3)=1316,但是我们需要用代码实现:
复制代码 代码如下:
$n=1316;
$i=0;//减去的第N个13,进行初始化为0
$y=16+13*$i;//1316分出来的16加上N个13,这里初始化为16
while($y%11!=0){//如果16加上N个13的和不能整除11
$i++;//再加一个13
$y=16+13*$i;
}
echo '$x='.($n-$y).'
';
echo '$y='.$y;
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6
Visual web development tools

Dreamweaver Mac version
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools
