jzcrq @ 2020-03-25 18:06:26
#include<bits/stdc++.h>
using namespace std;
int main(){
char a;
int b=10001,c[10001]={};
while(scanf("%c",&a)!='\n'){
if (a=='-'){
cout<<"-";
c[b]='-';
goto d;
}
if (b==10001&&a=='0'){
cout<<"0";
return 0;
}
b--;
if (b=='0') c[b]=0;
if (a=='1') c[b]=1;
if (a=='2') c[b]=2;
if (a=='3') c[b]=3;
if (a=='4') c[b]=4;
if (a=='5') c[b]=5;
if (a=='6') c[b]=6;
if (a=='7') c[b]=7;
if (a=='8') c[b]=8;
if (a=='9') c[b]=9;
d:a=a;
if (a=='\n') goto c;
}
c:for (int d=b;d<=10000;d++){
if (c[d]!=0)
cout<<c[d];
else if (c[d]==0&&d!=b&&d!=10000) cout<<c[d];
}
return 0;
}
30分,但是好像没什么问题啊
by liqingyang @ 2020-03-25 18:27:32
@PrincessYR✨~ tql,%%%
by PrincessYR✨~ @ 2020-03-25 18:27:49
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b,c=0,d;
cin>>a;
do
{
c=c*10+a%10;
a=a/10;
}while(a!=0);
cout<<c;
return 0;
}
by xhQYm @ 2020-03-25 18:28:54
@liqingyang 我用的是字符串^_^。你的数字代码当然短啦
by liqingyang @ 2020-03-25 18:29:44
@qym2008 我用字符串更短,直接reverse。。。
by xhQYm @ 2020-03-25 18:30:44
@liqingyang 艹忘了reverse函数。
by 崔化博 @ 2020-05-09 14:36:42
代码如果输入:-830 会输出:-038
by 崔化博 @ 2020-05-09 14:39:04
@lscrq
by Lance_03 @ 2020-05-14 18:15:58
@qym2008 其实可以在前面判断正负 判断如果为负就把它改成正的