讨论 / 帖出本人恶心的程序(AC)
vinence 2008-08-25 23:22:00
点我顶贴 收藏 删除
var

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

#1 Jollwish@2008-08-04 05:15:00
回复 删除
你不觉得这不更恶心吗

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.

#2 pascalnew@2008-08-05 02:41:00
回复 删除
var

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.

#3 DarkMaster@2008-08-25 23:22:00
回复 删除
LS的,帖错地方了吧...
#4 fantianqi@2016-02-05 22:10:00
回复 删除
var i,ans,len:longint;

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.

呵呵,你不觉得这不更恶心吗!

#5 fantianqi@2016-02-05 22:11:50
回复 删除
var i,ans,len:longint;

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.

查看更多回复
提交回复