| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
不知道哪错了...............哪位大牛看看啊Program lostcity;
Const
infile = 'pow1.in';
outfile = 'pow1.out';
Var
num:Array [1..1000] of Longint;
pow:Array [1..1000] of Integer;
b,i,mid1,count,count1,j,k:longint;
ans,ans1,ans2,ans11,ans12,a:Longint;
Begin
Assign(input,infile);
Assign(output,outfile);
Reset(input);
Rewrite(output);
a:=-1;
b:=-1;
count:=0;
While((a<>0)and(b<>0))do begin
Readln(a,b);
if ((a=0)and(b=0)) then break;
Inc(count);
num[count]:=a;pow[count]:=b;
end;
For i:=1 to count do begin
if num[i]<pow[i] then begin
Writeln(1);
Close(input);Close(output);halt;
end;
For j:=1 to 1000 do begin
ans:=j;
For k:=1 to pow[i]-1 do
ans:=ans*j;
if ans>=num[i] then begin mid1:=j; break;end;
end;
ans1:=1;ans2:=1;
For j:=1 to pow[i] do ans1:=ans1*(mid1-1);
For j:=1 to pow[i] do ans2:=ans2*mid1;
ans11:=abs(ans1-num[i]);
ans12:=abs(ans2-num[i]);
if ans-num[i]=0 then Writeln(mid1)
else if ans11>ans12 then Writeln(mid1)
else Writeln(mid1-1);
end;
Close(input);
Close(output);
End.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator