1419 - 立方和问题
时间限制 : 1 秒
内存限制 : 128 MB
<span style="font-size:22pt;"><span>•</span></span><span style="font-family:宋体;color:black;font-size:22pt;">考虑方程式:</span><span style="font-family:Arial;color:black;font-size:22pt;">a^3 + b^3 = c^3 + d^3</span><span style="font-family:Arial;color:black;font-size:22pt;"> </span>
<span style="font-size:22pt;"><span>•</span></span><span style="font-family:宋体;color:black;font-size:22pt;">其中:“</span><span style="font-family:Arial;color:black;font-size:22pt;">^</span><span style="font-family:Arial;color:black;font-size:22pt;">”表示乘方。</span><span style="font-family:Arial;color:black;font-size:22pt;">a</span><span style="font-family:宋体;color:black;font-size:22pt;">、</span><span style="font-family:Arial;color:black;font-size:22pt;">b</span><span style="font-family:宋体;color:black;font-size:22pt;">、</span><span style="font-family:Arial;color:black;font-size:22pt;">c</span><span style="font-family:宋体;color:black;font-size:22pt;">、</span><span style="font-family:Arial;color:black;font-size:22pt;">d</span><span style="font-family:宋体;color:black;font-size:22pt;">是互不相同的小于</span><span style="font-family:Arial;color:black;font-size:22pt;">30</span><span style="font-family:宋体;color:black;font-size:22pt;">的正整数。</span>
<span style="font-size:22pt;"><span>•</span></span><span style="font-family:宋体;color:black;font-size:22pt;">这个方程有很多解。比如:</span>
<span style="font-size:22pt;"><span>•</span></span><span style="font-family:Arial;color:black;font-size:22pt;">a = 1</span><span style="font-family:宋体;color:black;font-size:22pt;">,</span><span style="font-family:Arial;color:black;font-size:22pt;">b=12</span><span style="font-family:宋体;color:black;font-size:22pt;">,</span><span style="font-family:Arial;color:black;font-size:22pt;">c=9</span><span style="font-family:宋体;color:black;font-size:22pt;">,</span><span style="font-family:Arial;color:black;font-size:22pt;">d=10 </span><span style="font-family:宋体;color:black;font-size:22pt;">就是一个解。因为:</span><span style="font-family:Arial;color:black;font-size:22pt;">1</span><span style="font-family:宋体;color:black;font-size:22pt;">的立方加</span><span style="font-family:Arial;color:black;font-size:22pt;">12</span><span style="font-family:宋体;color:black;font-size:22pt;">的立方等于</span><span style="font-family:Arial;color:black;font-size:22pt;">1729</span><span style="font-family:宋体;color:black;font-size:22pt;">,而</span><span style="font-family:Arial;color:black;font-size:22pt;">9</span><span style="font-family:宋体;color:black;font-size:22pt;">的立方加</span><span style="font-family:Arial;color:black;font-size:22pt;">10</span><span style="font-family:宋体;color:black;font-size:22pt;">的立方也等于</span><span style="font-family:Arial;color:black;font-size:22pt;">1729</span><span style="font-family:宋体;color:black;font-size:22pt;">。</span>
<span style="font-size:22pt;"><span>•</span></span><span style="font-family:宋体;color:black;font-size:22pt;">当然,</span><span style="font-family:Arial;color:black;font-size:22pt;">a=12</span><span style="font-family:宋体;color:black;font-size:22pt;">,</span><span style="font-family:Arial;color:black;font-size:22pt;">b=1</span><span style="font-family:宋体;color:black;font-size:22pt;">,</span><span style="font-family:Arial;color:black;font-size:22pt;">c=9</span><span style="font-family:宋体;color:black;font-size:22pt;">,</span><span style="font-family:Arial;color:black;font-size:22pt;">d=10 </span><span style="font-family:宋体;color:black;font-size:22pt;">显然也是解。</span>
<span style="font-size:22pt;"><span>•</span></span><span style="font-family:宋体;color:black;font-size:22pt;">如果不计</span><span style="font-family:Arial;color:black;font-size:22pt;">abcd</span><span style="font-family:宋体;color:black;font-size:22pt;">交换次序的情况,这算同一个解。</span>
<span style="font-size:22pt;"><span>•</span></span><span style="font-family:宋体;color:black;font-size:22pt;">你的任务是:找到所有小于</span><span style="font-family:Arial;color:black;font-size:22pt;">30</span><span style="font-family:宋体;color:black;font-size:22pt;">的不同的正整数解。把</span><span style="font-family:Arial;color:black;font-size:22pt;">a b c d</span><span style="font-family:宋体;color:black;font-size:22pt;">按从小到大排列,用逗号分隔,每个解占用</span><span style="font-family:Arial;color:black;font-size:22pt;">1</span><span style="font-family:宋体;color:black;font-size:22pt;">行。比如,刚才的解输出为:</span>
输入
输出
样例
输入
输出
来源
蓝桥杯-历届试题