求大神告诉我为毛只有50

P1307 [NOIP2011 普及组] 数字反转

Ruican @ 2015-09-05 21:26:16

Var number,num1,num2:ansistring;
    i,j,k,l,m:longint;
    numtype:integer;
function change(num:string):ansistring;
  begin
    k:=0;
    change:='';
    if not(num='0') then begin
      j:=length(num);
      for i:=j downto 1 do begin
        if num[i]='0' then k:=k+1;
        if not (num[i]='0') then break;
      end;
      for i:=j-k downto 1 do
        change:=change+(num[i]);
    end
    else change:=('0');
  end;
Begin
  readln(number);
  for l:=1 to (length(number)) do
    case number[l] of
      '.': begin numtype:=1; break; end;
      '%': begin numtype:=2; break; end;
      '/': begin numtype:=3; break; end;
    else numtype:=0;
    end;
  case numtype of
    1: begin
               num1:='';
               for m:=1 to l-1 do
                 num1:=num1+number[m];
               num2:='';
               for m:=l+1 to length(number) do
                 num2:=num2+number[m];
               num1:=change(num1);
               if num1='' then num1:='0';
               num2:=change(change(change(num2)));
               if num2='' then num2:='0';
               write(num1,'.',num2);
             end;
    2: begin
               num1:='';
               for m:=1 to l-1 do
                 num1:=num1+number[m];
               num1:=change(num1);
               if num1='' then num1:='0';
               write(num1,'%');
             end;
    3: begin
               num1:='';
               for m:=1 to l-1 do
                 num1:=num1+number[m];
               num2:='';
               for m:=l+1 to length(number) do
                 num2:=num2+number[m];
               num1:=change(num1);
               if num1='' then num1:='0';
               num2:=change(num2);
               write(num1,'/',num2);
             end;
    0: begin
               number:=change(number);
               write(number);
             end;
    end;
    readln;
end.

by hecheng @ 2015-09-06 12:25:33

代码太长。。。评定系统看你不爽。。。


by mob_spawner @ 2015-09-06 16:47:59

[codec ]不知道,也许是……反正就是评定系统对你有xxx[/codec ]


by 太阳之神2015 @ 2015-09-08 21:39:24

光看的代码偶就要晕了,评定系统还会鸟你吗。。。


by 孙遥 @ 2015-09-24 17:22:41

因为你说粗口“为毛”。所以我这个世外高人不会教你。


by yangtian @ 2016-01-26 17:09:23

太长了,看我的!!

var i,j,k,p,m:longint;  
  s:ansistring;  
begin  
  readln(s);  
  k:=1;  
  if s[1]='-' then 
                begin 
                  write('-');  
                  inc(k);  
                end;  
  j:=length(s);  
  while s[j]='0' do 
    dec(j);
  for i:=j downto k do 
    write(s[i]);  
end.

|