a:ansistring;
total:longint;
i,l:integer;
ls:char;
ok:boolean;
begin
readln(a);
l:=length(a);
for i:=1 to l do inc(total,ord(a[i])-ord(’0’));
ok:=false;
for i:=l downto 1 do
begin
if a[i]<>’0’ then ok:=true;
if ok then write(a[i]);
end;
writeln;
writeln(total);
end.
--------------------------------------------------
状态题目:巨型整数
题目编号:143-巨型整数 [查看该题]
状态: Accepted
测评机: Xeost[5]
得分: 100分
提交日期: 2008-8-3 22:50:00
有效耗时: 719毫秒
测试结果1: 通过本测试点|有效耗时172:ms
测试结果2: 通过本测试点|有效耗时78:ms
测试结果3: 通过本测试点|有效耗时94:ms
测试结果4: 通过本测试点|有效耗时78:ms
测试结果5: 通过本测试点|有效耗时62:ms
测试结果6: 通过本测试点|有效耗时47:ms
测试结果7: 通过本测试点|有效耗时47:ms
测试结果8: 通过本测试点|有效耗时47:ms
测试结果9: 通过本测试点|有效耗时47:ms
测试结果10: 通过本测试点|有效耗时47:ms
var a:array[1..20000]of integer;
i,n,p:integer;
s:qword;
t:ansistring;
begin
s:=0;
readln(t);
n:=length(t);
for i:=1 to n do
a[i]:=ord(t[i])-ord(’0’);
p:=n;
while a[p]=0 do dec(p);
for i:=p downto 1 do
begin
write(a[i]);
s:=s+a[i];
end;
writeln;
write(s);
end.
n,k,s:real;
begin
readln(k);
n:=0;
repeat
n:=n+1;
s:=s+1/n;
until s>k;
writeln(n:0:0);
end.
s:ansistring;
begin
readln(s);
len:=length(s);
while s[len]='0' do begin delete(s,len,1);dec(len); end;
for i:=len downto 1 do write(s[i]); writeln;
for i:=1 to len do ans:=ans+ord(s[i])-48;
writeln(ans);
end.
呵呵,你不觉得这不更恶心吗!
s:ansistring;
begin
readln(s);
len:=length(s);
while s[len]='0' do begin delete(s,len,1);dec(len); end;
for i:=len downto 1 do write(s[i]); writeln;
for i:=1 to len do ans:=ans+ord(s[i])-48;
writeln(ans);
end.