Alien_99 @ 2016-02-20 11:20:27
#include<stdio.h>
int main(){
int n,a,b,c,d;
scanf("%d",&n);
a=n/100;
b=(n/10)%10;
c=n%10;
d=c*100+b*10+a;
printf("%d",d);
return 0 ;
}
by CInDY @ 2016-02-20 11:25:40
因为并不是所有数据都为三位数……
by Alien_99 @ 2016-02-20 11:27:31
欧。。。。。
by CInDY @ 2016-02-20 11:29:36
我用pascal打的,虽然水平不高。
[codep]
program P1307;
var
a:string;
i,j:integer;
begin
readln(a);
if a='0' then
begin
writeln('0');
exit;
end;
if a[1]='-' then write('-');
j:=0;
for i:=length(a) downto 1 do
if a[i]='0' then j:=j+1
else break;
for i:=length(a)-j downto 1 do if a[i]<>'-' then write(a[i]);
writeln;
end.
[/codep]
by kongksora @ 2016-02-20 12:19:48
[codec]
#include<iostream>
#include<string>
using namespace std;
int main()
{
string a,b="";
cin>>a;
if(a[0]=='-'){cout<<'-';a.erase(0,1);}
while(a!="")
{
b+=a[a.size()-1];
a.erase(a.size()-1,1);
}
while(b[0]=='0'&&b!="0")b.erase(0,1);
cout<<b;
}
[/codec]
by Hyle33ies @ 2016-02-20 19:08:45
你这个是三位数吧
by Blue_water @ 2016-03-03 12:38:30
我是这样做的:
var st:string;
i,t:longint;
begin
readln(st);
if st[1]='-' then begin delete(st,1,1); st:=st+'-'; end;
for i:=length(st) downto 1 do
begin
if (st[i]<>'0') and (t=0) and (st[i]<>'-') then begin write(st[i]);t:=1; end else
if (t=1) or (st[i]='-') then write(st[i]);
end;
end.