1 条题解

  • 0
    @ 2025-4-12 21:43:14

    C++ :

    #include<stdio.h>
    
    int main()
    {
    	int a,b,c,d,e,f,g;
    	scanf("%d",&a);
    	b=a/10000;
    	c=a/1000%10;
    	d=a/100%10;
    	e=a/10%10;
    	f=a%10;
    	g=f*10000+e*1000+d*100+c*10+b;
    	printf("%d",g);
    	return 0;
    }
    

    Pascal :

    var s:string;
    
    v,flag:int64;
    
    c,i,len:longint;
    
    begin
    
    read(s);
    
    val(s,v,c);
    
    if (v=0) then write(0) else
    
    if ((v<0) and (s[length(s)]='0')) then delete(s,length(s),1) else
    
    if ((v>0) and (s[length(s)]='0')) then delete(s,length(s),1);
    
    len:=length(s)+1;
    
    repeat
    
    if s[len]='0' then delete(s,len,1);
    
    dec(len);
    
    until s[len]<>'0';
    
    if (v<0) then
    
    begin
    
    delete(s,1,1);
    
    flag:=1;
    
    end;
    
    if flag=1 then write('-');
    
    for i:=length(s) downto 1 do
    
    write(s[i]);
    
    end.
    
    
    • 1

    信息

    ID
    1290
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者