📄 1543 -- perfect cubes.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0035)http://poj.grids.cn/problem?id=1543 -->
<HTML><HEAD><TITLE>1543 -- Perfect Cubes</TITLE>
<META http-equiv=Pragma content=no-cache>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="1543 -- Perfect Cubes.files/poj.css" type=text/css rel=stylesheet>
<SCRIPT language=javascript src="1543 -- Perfect Cubes.files/poj.js"></SCRIPT>
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY vLink=blue aLink=blue link=blue leftMargin=5><A name=top></A>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#ffffff width="100%"
border=1>
<TBODY>
<TR>
<TD
style="BACKGROUND-IMAGE: url(images/header.jpg); BACKGROUND-REPEAT: no-repeat; TEXT-ALIGN: right"
vAlign=bottom align=middle colSpan=5 height=160>
<DIV style="MARGIN-BOTTOM: 0px"><IMG
src="1543 -- Perfect Cubes.files/logopku.gif" border=0> <IMG
src="1543 -- Perfect Cubes.files/logo4.gif" border=0></DIV></TD></TR>
<TR vAlign=top align=middle bgColor=#6589d1>
<TH class=h>Online Judge</TH>
<TH class=h>Problem Set</TH>
<TH class=h>Authors</TH>
<TH class=h>Online Contests</TH>
<TH class=h>User</TH></TR>
<TR vAlign=top align=middle bgColor=#f1f1fd>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)"><A
href="http://poj.grids.cn/bbs">Web Board</A><BR><A
href="http://poj.grids.cn/">Home Page</A><BR><A
href="http://poj.grids.cn/faq.htm"
target=_blank>F.A.Qs</A><BR>Announcement</TD>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)">
<FORM action=gotoproblem method=get><A
href="http://poj.grids.cn/problemlist">Problems</A><BR><A
href="http://poj.grids.cn/submit">Submit Problem</A><BR><A
href="http://poj.grids.cn/status">Online Status</A><BR><FONT
color=blue>Prob.ID:</FONT><INPUT size=6 name=pid><INPUT type=submit value=Go name=pb1></FORM></TD>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)">
<FORM action=searchuser method=get><A
href="http://poj.grids.cn/register">Register</A><BR><A
href="http://poj.grids.cn/modifyuser">Update your info</A><BR><A
href="http://poj.grids.cn/userlist">Authors ranklist</A><BR><INPUT size=10
name=key><INPUT type=submit value=Search name=B1></FORM></TD>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)"><FONT
color=#1a5cc8>Current Contest</FONT><BR><A
href="http://poj.grids.cn/pastcontests">Past Contests</A><BR><A
href="http://poj.grids.cn/contests">Scheduled Contests</A><BR><A
href="http://poj.grids.cn/awardcontest_announce.htm" target=_blank><FONT
color=red>Award Contest</FONT></A></TD>
<TD class=h onmouseover="scbg(this, 1)" onmouseout="scbg(this, 0)"
align=left>
<FORM action=login method=post>
<TABLE>
<TBODY>
<TR>
<TD>User ID:</TD>
<TD><INPUT size=10 name=user_id1></TD></TR>
<TR>
<TD>Password:</TD>
<TD><INPUT type=password size=10 name=password1></TD></TR></TBODY></TABLE><INPUT type=submit value=login name=B1> <A
href="http://poj.grids.cn/register" target=_parent>Register</A><INPUT
type=hidden value=/problem?id=1543 name=url></FORM></TD></TR></TBODY></TABLE>
<TABLE width="100%" background="1543 -- Perfect Cubes.files/table_back.jpg"
border=0>
<TBODY>
<TR>
<TD>
<P align=center><FONT color=blue size=5>Perfect Cubes</FONT> <BR>Time
Limit:1000MS Memory Limit:10000K<BR>Total Submit:1786 Accepted:1080
</P>
<P><FONT color=blue size=5>Description</FONT><BR><FONT
face="Times New Roman" size=3>For hundreds of years Fermat's Last Theorem,
which stated simply that for n > 2 there exist no integers a, b, c >
1 such that a^n = b^n + c^n, has remained elusively unproven. (A recent
proof is believed to be correct, though it is still undergoing scrutiny.)
It is possible, however, to find integers greater than 1 that satisfy the
"perfect cube" equation a^3 = b^3 + c^3 + d^3 (e.g. a quick calculation
will show that the equation 12^3 = 6^3 + 8^3 + 10^3 is indeed true). This
problem requires that you write a program to find all sets of numbers
{a,b,c,d} which satisfy this equation for a <= N.</FONT></P>
<P><FONT color=blue size=5>Input</FONT><BR><FONT face="Times New Roman"
size=3>One integer N (N <= 100).</FONT></P>
<P><FONT color=blue size=5>Output</FONT><BR><FONT face="Times New Roman"
size=3>The output should be listed as shown below, one perfect cube per
line, in non-decreasing order of a (i.e. the lines should be sorted by
their a values). The values of b, c, and d should also be listed in
non-decreasing order on the line itself. There do exist several values of
a which can be produced from multiple distinct sets of b, c, and d
triples. In these cases, the triples with the smaller b values should be
listed first. </FONT></P>
<P><FONT color=blue size=5>Sample Input</FONT><BR><FONT
face="Times New Roman" size=3><PRE>24</PRE></FONT>
<P></P>
<P><FONT color=blue size=5>Sample Output</FONT><BR><FONT
face="Times New Roman" size=3><PRE>Cube = 6, Triple = (3,4,5)
Cube = 12, Triple = (6,8,10)
Cube = 18, Triple = (2,12,16)
Cube = 18, Triple = (9,12,15)
Cube = 19, Triple = (3,10,18)
Cube = 20, Triple = (7,14,17)
Cube = 24, Triple = (12,16,20)</PRE></FONT>
<P></P>
<P><FONT color=blue size=5>Source</FONT><BR><FONT face="Times New Roman"
size=3><A
href="http://poj.grids.cn/searchproblem?field=source&key=Mid-Central USA 1995">Mid-Central
USA 1995</A></FONT></P></TD></TR></TBODY></TABLE><FONT color=#333399 size=3>
<P align=center>[<A
href="http://poj.grids.cn/submit?problem_id=1543">Submit</A>] [<A
href="javascript:history.go(-1)">Go Back</A>] [<A
href="http://poj.grids.cn/problemstatus?problem_id=1543">Status</A>]
[<A href="http://poj.grids.cn/bbs?problem_id=1543">Discuss</A>] </FONT></P>
<P><IMG height=30 src="1543 -- Perfect Cubes.files/home.gif" width=40
border=0><FONT size=3><A href="http://poj.grids.cn/">Home Page</A>
</FONT> <IMG height=30 src="1543 -- Perfect Cubes.files/goback.gif"
width=40 border=0><FONT size=3><A href="javascript:history.go(-1)">Go
Back</A> <IMG height=30 src="1543 -- Perfect Cubes.files/top.gif"
width=40 border=0><A href="http://poj.grids.cn/problem?id=1543#top">To
top</A></FONT><BR>
<HR>
<P style="FONT-FAMILY: Arial," align=center sans-serif Helvetica,>All Rights
Reserved 2003-2006 Ying Fuchen,Xu Pengcheng,Xie Di<BR>Any problem, Please <A
href="mailto:xiedipoj@yahoo.com">Contact Administrator</A></P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -