Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

给用PASCAL的~~~

Posted by SPCD at 2010-03-28 20:02:20 on Problem 1543 and last updated at 2010-04-04 08:14:57
rt
16ms的
(全把答案弄出来的打表太烦了...)

program pku1543;

const cube:array [1..100]of longint=(1,8,27,64,125,216,343,512,729,1000,
1331,1728,2197,2744,3375,4096,4913,5832,6859,8000,9261,10648,12167,13824,
15625,17576,19683,21952,24389,27000,29791,32768,35937,39304,42875,46656,
50653,54872,59319,64000,68921,74088,79507,85184,91125,97336,103823,110592,
117649,125000,132651,140608,148877,157464,166375,175616,185193,195112,
205379,216000,226981,238328,250047,262144,274625,287496,300763,314432,
328509,343000,357911,373248,389017,405224,421875,438976,456533,474552,
493039,512000,531441,551368,571787,592704,614125,636056,658503,681472,
704969,729000,753571,778688,804357,830584,857375,884736,912673,941192,
970299,1000000);
n=100;

var
  i,j,k,g:integer;
begin
  for g:= 5 to n do
    for i:= 2
    to g-3 do
      for j:= i+1 to g-2 do
        for k:= j+1 to g-1 do
        if cube[i]+cube[j]+cube[k]=cube[g] then
          writeln('Cube = ',g,', Triple = (',i,',',j,',',k,')');
close(output);
end.

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator