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 IceKingdom at 2008-10-03 12:31:35 on Problem 2191
In Reply To:求正解......我辛苦算出来的表居然wa了!~~~~ Posted by:palmtenor at 2005-03-06 22:33:32
program sf;
var t,n:qword;
    k,count,i,j:longint;
    a:array[1..10,0..1000]of qword;
    tag:boolean;
    b:array[1..9]of qword;
begin
      assign(input,'t2191.in'); reset(input); assign(output,'t2191.out'); rewrite(output);


b[1]:=11;
a[1,0]:=2; a[1,1]:=23; a[1,2]:=89;
b[2]:=23;
a[2,0]:=2; a[2,1]:=47; a[2,2]:=178481;
b[3]:=29;
a[3,0]:=3; a[3,1]:=233; a[3,2]:=1103; a[3,3]:=2089;
b[4]:=37;
a[4,0]:=2; a[4,1]:=223; a[4,2]:=616318177;
b[5]:=41;
a[5,0]:=2; a[5,1]:=13367; a[5,2]:=164511353;
b[6]:=43;
a[6,0]:=3; a[6,1]:=431; a[6,2]:=9719; a[6,3]:=2099863;
b[7]:=47;
a[7,0]:=3; a[7,1]:=2351; a[7,2]:=4513; a[7,3]:=13264529;
b[8]:=53;
a[8,0]:=3; a[8,1]:=6361; a[8,2]:=69431; a[8,3]:=20394401;
b[9]:=59;
a[9,0]:=2; a[9,1]:=179951; a[9,2]:=3203431780337;
        readln(k);
        for i:=1 to 9 do
         if b[i]<=k
          then begin
           n:=1; for j:=1 to b[i] do n:=n shl 1; dec(n);
           for j:=1 to a[i,0]-1 do write(a[i,j],' * ');
           write(a[i,a[i,0]]);
           write(' = ');
           write(n);
           write(' = ');
           writeln('( 2 ^ ',b[i],' ) - 1');
          end
          else break;

      close(input); close(output);
end.

{count:=0;
       for k:=11 to 63 do begin
        n:=1; for i:=1 to k do n:=n*2; dec(n);
        tag:=true;
        for i:=2 to trunc(sqrt(k)) do if k mod i=0 then begin tag:=false; break; end;
        if not tag then continue;
        t:=n; fillchar(a,sizeof(a),0);
        for i:=2 to trunc(sqrt(n)) do begin
         if t mod i=0
          then begin
           inc(a[0]); a[a[0]]:=i;
           t:=t div i;
          end;
         if t=0 then break;
        end;
        if (t>1) and (t<>n) then begin inc(a[0]); a[a[0]]:=t; end;
        if a[0]>0
         then begin
          inc(count);
          writeln('b[',count,']:=',k,';'); write('a[',count,',0]:=',a[0],'; ');
          for i:=1 to a[0] do write('a[',count,',',i,']:=',a[i],'; '); writeln;
         end;
       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