Gọi [x] là phần nguyên của số nguyên x. Ví dụ [7,89]=7; [5,32]=5 Nhập n, hãy lập trình tính: $[\sqrt[3]{1}]+[\sqrt[3]{2}]+[\sqrt[3]{3}]+…+[\sqrt[3]

Gọi [x] là phần nguyên của số nguyên x. Ví dụ [7,89]=7; [5,32]=5
Nhập n, hãy lập trình tính:
$[\sqrt[3]{1}]+[\sqrt[3]{2}]+[\sqrt[3]{3}]+…+[\sqrt[3]{n}]$
Yêu cầu: Dùng file

0 bình luận về “Gọi [x] là phần nguyên của số nguyên x. Ví dụ [7,89]=7; [5,32]=5 Nhập n, hãy lập trình tính: $[\sqrt[3]{1}]+[\sqrt[3]{2}]+[\sqrt[3]{3}]+…+[\sqrt[3]”

  1. Const Fi=’TPN.INP’;
          Fo=’TPN.OUT’;
    Var f,g: text;
        n: qword;
        so,s: extended;
        i: longint;

    Begin
            Assign(f,Fi); Reset(f);
            Assign(g,Fo); Rewrite(g);
            Read(f,n);
            s:=0;
            For i:=1 to n do
            Begin
                    s:=s+int(exp((1/3)*ln(i)));
            End;
            Write(g,s:0:0);
            Close(f);
            Close(g);
    End.

    Bình luận
  2. var n,i:longint;
        t:int64;
        f:text;
    //
    function pow(x:longint):int64;
    begin
    exit(x*x*x);
    end;
    //
    begin
    assign(f,’POW.INP’);
    reset(f);
    readln(f,n);
    close(f);
    t:=0;
    for i:=1 to 1000 do
     if pow(i+1)<=n then inc(t,i*(pow(i+1)-i*i*i))
      else if (i*i*i<=n) and (n<pow(i+1)) then begin
                                              t:=t+i*(n-pow(i)+1);
                                              break;
                                              end;
    assign(f,’POW.OUT’);
    rewrite(f);
    write(f,t);
    close(f);
    end.

    Bình luận

Viết một bình luận